now up and running using docker
This commit is contained in:
@@ -11,23 +11,6 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func initLogging() {
|
||||
// Ensure the logs directory exists
|
||||
if err := os.MkdirAll("logs", 0755); err != nil {
|
||||
log.Fatalf("Failed to create log directory: %v", err)
|
||||
}
|
||||
|
||||
// Open the log file
|
||||
f, err := os.OpenFile("logs/api.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to open log file: %v", err)
|
||||
}
|
||||
|
||||
// Set log output
|
||||
log.SetOutput(f)
|
||||
gin.DefaultWriter = f // capture Gin logs too
|
||||
}
|
||||
|
||||
func RegisterModels() {
|
||||
assets.RegisterModels()
|
||||
logs.RegisterModels()
|
||||
@@ -39,11 +22,14 @@ func RegisterRoutes(r *gin.Engine) {
|
||||
assets.RegisterRoutes(group)
|
||||
logs.RegisterRoutes(group)
|
||||
taxonomy.RegisterRoutes(group)
|
||||
|
||||
r.GET("/health", func(c *gin.Context) {
|
||||
c.Status(200)
|
||||
})
|
||||
}
|
||||
|
||||
func main() {
|
||||
initLogging()
|
||||
|
||||
log.SetOutput(os.Stdout)
|
||||
log.Println("Starting API server...")
|
||||
|
||||
// connect to database
|
||||
|
||||
Reference in New Issue
Block a user