Load 404 error page
This commit is contained in:
parent
d854809313
commit
3cd68987a2
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue