1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: log unmatched requests

This commit is contained in:
Ferdinand Mütsch 2021-06-24 21:40:51 +02:00
parent 312dfb36d8
commit c3957ec0c8

View File

@ -189,6 +189,14 @@ func main() {
rootRouter := router.PathPrefix("/").Subrouter() rootRouter := router.PathPrefix("/").Subrouter()
apiRouter := router.PathPrefix("/api").Subrouter().StrictSlash(true) apiRouter := router.PathPrefix("/api").Subrouter().StrictSlash(true)
// https://github.com/gorilla/mux/issues/416
router.NotFoundHandler = router.NewRoute().BuildOnly().HandlerFunc(http.NotFound).GetHandler()
router.NotFoundHandler = middlewares.NewLoggingMiddleware(logbuch.Info, []string{
"/assets",
"/favicon",
"/service-worker.js",
})(router.NotFoundHandler)
// Globally used middlewares // Globally used middlewares
router.Use(middlewares.NewPrincipalMiddleware()) router.Use(middlewares.NewPrincipalMiddleware())
router.Use(middlewares.NewLoggingMiddleware(logbuch.Info, []string{"/assets"})) router.Use(middlewares.NewLoggingMiddleware(logbuch.Info, []string{"/assets"}))