This commit is contained in:
cangui 2025-08-18 19:14:24 +02:00
parent 31849cf4d3
commit 7b01b1b928

View File

@ -240,8 +240,12 @@ func startHTTP() {
routes.AddRoutes(api, bd) routes.AddRoutes(api, bd)
utils.CreateDefaultFolder(bd) utils.CreateDefaultFolder(bd)
app.Static("/static", "./web") // Sert tout le dossier /app/web à la racine
app.StaticFS("/", gin.Dir("./web", true))
// (Optionnel) fallback SPA si tu as un router côté front
app.NoRoute(func(c *gin.Context) { app.NoRoute(func(c *gin.Context) {
// Laisse passer les 404 d'API
if strings.HasPrefix(c.Request.URL.Path, "/api/") { if strings.HasPrefix(c.Request.URL.Path, "/api/") {
c.JSON(404, gin.H{"error": "Not found"}) c.JSON(404, gin.H{"error": "Not found"})
return return