feat: add custom 404 page with playful inline artwork and prose
This commit is contained in:
@@ -28,6 +28,15 @@ func ProvideRouter(cfg config.Config, htmlRender render.HTMLRender) *gin.Engine
|
||||
}
|
||||
r := gin.New()
|
||||
r.Use(CORSMiddlewareWithConfig(cfg), RequestContextMiddleware(), audit.ContextMiddleware(), RequestLogger(), gin.Recovery())
|
||||
r.NoRoute(func(c *gin.Context) {
|
||||
if acceptsHTML(c) {
|
||||
c.HTML(http.StatusNotFound, "not_found.gohtml", gin.H{
|
||||
"CurrentPath": c.Request.URL.Path,
|
||||
})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusNotFound, ErrorResponse{Error: "Not found"})
|
||||
})
|
||||
r.Static("/static", "./static")
|
||||
r.Static("/dist", "./dist")
|
||||
r.GET("/debug/pprof", gin.WrapH(http.DefaultServeMux))
|
||||
|
||||
Reference in New Issue
Block a user