I am following this tutorial. http://thenewstack.io/make-a-restful-json-api-go/
router := mux.NewRouter().StrictSlash(true)
for _, route := range routes {
router.
Methods(route.Method).
Path(route.Pattern).
Name(route.Name).
Handler(route.HandlerFunc)
}
I need to wrap the endpoint func using yaag middleware.
r.HandleFunc("/", middleware.HandleFunc(handler))
How to achieve this?
EDIT: I am wrapping in around the Logger and returning the haddler. Logger takes first argument, as http.Handle. So wrapping the route.HandlerFunc won't work. Can you please help me here?
handler := Logger(route.HandlerFunc, route.Name)
router.
Methods(route.Method).
Path(route.Pattern).
Name(route.Name).
Handler(handler)