mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-05-07 20:59:37 -05:00
[server] Move 404 handler to inside catch-all middleware
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user