Skip to content

Commit 6ba1db9

Browse files
committedAug 20, 2020
add 404 page logic if the URL is not found
1 parent 74e05c0 commit 6ba1db9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎server.go

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/labstack/echo/v4/middleware"
66
"html/template"
77
"io"
8+
"net/http"
89
)
910

1011
type Template struct {
@@ -47,6 +48,11 @@ func startWebServer() {
4748
}
4849
}
4950

51+
// Render 404 page
52+
echo.NotFoundHandler = func(c echo.Context) error {
53+
return c.Render(http.StatusNotFound, "404.html", "")
54+
}
55+
5056
// Serve the routes
5157
webRouter(e)
5258

0 commit comments

Comments
 (0)
Please sign in to comment.