h3 icon indicating copy to clipboard operation
h3 copied to clipboard

MIddlewares for routers

Open gulshan opened this issue 7 months ago • 0 comments

Describe the feature

Currently the middleware event handlers (with void return types) can only be attached with an App object, not a Router. Not even with a router.use('/**', middlewareEventHandler) method call. Only app.use(middlewareEventHandler, {/*specify route*/}) works. But, a lot of times, a middleware is only needed for a specific route, handled by a Router object. If middlewares were allowed to be attached to a Router, the logic would be quite straightforward.

So, my request would be, to allow middlewares to be attached with the Router objects, with a method like router.use(middlewareEventHandler).

Additional information

  • [ ] Would you be willing to help implement this feature?

gulshan avatar Jul 03 '24 09:07 gulshan