I'm coming from node express, and I was able to pass in as many middleware as possible, for example: routes.use('/*', ensureAuth, logImportant, ... n);
How can I do something similar when using r.GET("/", HomeIndex)
?
Am I forced to do something like EnsureAuth(HomeIndex)
? Because I can get that to work. Unfortunately, I'm not sure what would be a good way to add as many middlewares as I want without chaining functions together.
Is there a more elegant way so I could somehow use variadic type function to do r.GET("/", applyMiddleware(HomeIndex, m1, m2, m3, m4)
? I'm trying that out right now, but I feel like there's a better way to do this.
I've looked at the httprouter issues page, can't find anything :(
Thanks!
func(http.Handler) http.Handler
? – stevenferrerhttprouter.Handle
, and passing inhandle
of typehttprouter.Handle
. – a person