route-decorators
route-decorators copied to clipboard
Allow route decorators to receive array of middlewares as param
Sometimes we need to define a set of middlewares to present a functionality. For example, useAuth
middleware can be composed of [useJWT(), useMongoDB(), useUser()].
This PR is to allow route decorators to be easier to work within those cases.
Not sure I'm a fan of this. If it were me, I rather write something like below to be more explicit.
@post('url', ...middlewareGroup, anotherMiddleware)
Yeah, I agree. It makes sense to explicitly use the middleware group, I'm actually using that on my current codebase.
My problem is it quickly became nuisance when we started to use that everywhere (e.g. we must remember to put ...
operator) and it puts lots of noise around the codebase