Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 478 Bytes

set_not_found_handler.md

File metadata and controls

22 lines (15 loc) · 478 Bytes

Setting up a not found handler in utron

Custom rendering of 404 status page is easy in utron.

Utron App provides a method SetNotFoundHandler(h http.Handler) error which you can use it as follows.

First we define our handler function

func NotFound(w http.ResponseWriter, r *http.Request) {
	w.Write([]byte("we found nothing"))
}

And then we register it like this

	app := utron.NewApp()
	app.SetNotFoundHandler(http.HandlerFunc(NotFound))

Enjoy