Load 404 error page

This commit is contained in:
Nikurasu 2023-01-26 19:21:07 +01:00
parent d854809313
commit 3cd68987a2
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package router
import (
"fmt"
"net/http"
"github.com/gin-gonic/gin"
@ -23,7 +24,10 @@ func Create(env *envloader.Environment) *gin.Engine {
router.Static("/home", env.StaticDir)
// TODO: Load 404 error Page
router.LoadHTMLGlob(fmt.Sprintf("%s404.html", env.StaticDir))
router.NoRoute(func(ctx *gin.Context) {
ctx.HTML(http.StatusNotFound, "404.html", gin.H{})
})
return router
}