#is it possible to create multiple middlewares in nextjs ?
13 messages · Page 1 of 1 (latest)
I have an npm module for that exact purpose, I planned on releasing it later this week
But what you can do right now is just pull code into modules and import it in your middleware file
oh really
that's nice fr !
i've seen someone using something like stackedMiddlewares but didn't understand it that much
the module i made adds a few file conventions to the app directory and then generates a single middleware file in the root that combines those files
so a middleware in your /app folder will run on every request, a middleware in a /app/profile folder will run on every request starting with /profile etc.
it will have docs on how to integrate, im really excited to release it
hey any lucky yet on the multiple middleware issue
sorry for the delayed response. i have published the package here https://github.com/whopio/next-app-middleware - its still in beta for as long as the appDir is in experimental but we are actively implementing it and therefore maintaining it. the request and response objects passed to handlers are very sporadic right now, feel free to request any features you need or would make sense to have. if you have any issues or questions feel free to message me on discord or open an issue in the repo