NotFoundHandler


For defining a custom http.Handler to handle 404 Not Found example:

...

func my404() http.Handler {
    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        http.Error(w, "my custom 404 message", 404)
    })
}

func main() {
    router := violetear.New()
    router.NotFoundHandler = my404()
    ...
comments powered by Disqus