Open maxbrieiev opened 7 months ago
Thanks for logging this, since I had already started thinking about a related issue. I was thinking of the case of absolutely ordering middleware from plugins (imagine two different plugins provide middleware and one should run first), instead of just plugin vs normal middleware.
For plugins which statically declare middleware, we should be able to extract these and allow the user to order them as wanted. If any ordering is provided, we can interpret that as higher priority than routes.
It would be good to have the possibility to run plugin middlewares before middlewares defined inside
routes/
directory.One use case is to provide a pluggable authentication through plugins, so that a middleware inside the
routes/
folder could expect the session object to be available.