UP
This commit is contained in:
parent
31849cf4d3
commit
7b01b1b928
6
main.go
6
main.go
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user