-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Middlewares in mux Router #463
Comments
@niondir The middleware's are already supported: Line 14 in 4a87f8a
eg example: go-coap/examples/simple/server/main.go Line 42 in 4a87f8a
Do you need something more ? |
I need to check that later. Maybe I was missing it in earlier Versions and just missed when it was added. Actually I very like the inline syntax of chi. But that's very opinionated, I will see how this works out. |
Just missing: Adding middleware inline is a quiet nice API. Better than wrapping functions in functions. |
Ok. So, pls, could you contribute the function? Thx |
Need to find some time but I will if nobody else does before me :) |
Is there any plan to support Middlewares in mux.Router?
I imagine some API like in chi.Router (see: https://github.com/go-chi/chi/blob/master/mux.go)
func (mx *Mux) Use(middlewares ...func(http.Handler) http.Handler)
func (mx *Mux) With(middlewares ...func(http.Handler) http.Handler) Router
And optionally:
func (mx *Mux) Group(fn func(r Router)) Router
Code seems straight forward and easy to implement.
Currently I use some custom code, but it's not nice to use:
The text was updated successfully, but these errors were encountered: