package main import ( "expvar" "net/http" "github.com/julienschmidt/httprouter" ) func (app *application) routes() http.Handler { router := httprouter.New() router.NotFound = http.HandlerFunc(app.notFoundResponse) router.MethodNotAllowed = http.HandlerFunc(app.methodNotAllowResponse) router.HandlerFunc(http.MethodGet, "/v1/healthcheck", app.healthcheckHandler) router.Handler(http.MethodGet, "/debug/vars", expvar.Handler()) return app.metrics( app.recoverPanic( app.enableCORS( app.rateLimit( app.authenticate(router), ), ), ), ) }