diff --git a/server/internal/command/serve/cmd.go b/server/internal/command/serve/cmd.go index 70e40dae..1ca272b3 100644 --- a/server/internal/command/serve/cmd.go +++ b/server/internal/command/serve/cmd.go @@ -86,6 +86,12 @@ func setupWebApp(r gin.IRoutes, webAppSrcDir string) { } else { http.ServeFile(c.Writer, c.Request, indexFilePath) } + } else { + c.JSON(http.StatusNotFound, gin.H{ + "status": 404, + "code": "route_not_found", + "msg": "Route Not Found", + }) } } r.Use(staticFileHandler) diff --git a/server/internal/command/serve/engine.go b/server/internal/command/serve/engine.go index 2d1ea09f..6bd1a593 100644 --- a/server/internal/command/serve/engine.go +++ b/server/internal/command/serve/engine.go @@ -21,13 +21,6 @@ func createEngine() *gin.Engine { "msg": "Internal Server Error", }) })) - engine.NoRoute(func(c *gin.Context) { - c.JSON(http.StatusNotFound, gin.H{ - "status": 404, - "code": "route_not_found", - "msg": "Route Not Found", - }) - }) if Cfg.LogBody { engine.Use(logBodyMiddleware) }