Add internal server error page

This commit is contained in:
2024-05-13 22:52:00 +07:00
parent 74aae18fee
commit 420140918c
6 changed files with 57 additions and 15 deletions

View File

@ -193,6 +193,11 @@ func SetupRoutes() *http.ServeMux {
http.ServeFile(w, r, "public/favicon.ico")
})
//TODO add error message catching to the middleware so we can show the error message at the error page
handler.HandleFunc("/test", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "anjay", http.StatusInternalServerError)
})
fileServer := http.FileServer(http.Dir("./public"))
handler.Handle("/public/", http.StripPrefix("/public", fileServer))