now up and running using docker

This commit is contained in:
2025-04-17 15:22:55 +02:00
parent 5337da219e
commit 22b6f3bd2a
10 changed files with 80 additions and 117 deletions

View File

@@ -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