Next.js Discord

Discord Forum

Middleware basics

Answered
Red-naped Sapsucker posted this in #help-forum
Open in Discord
Red-naped SapsuckerOP
Hey some quick questions about middleware:

- Can there only be a a single middleware.ts per app?
- Using custom matcher config only allows for basically one middleware code that runs for all matched routes, because theres only one export const matcher?
- So when I need different logic for specific routes, I need to use conditional statements?

Sorry if my assumptions are wrong, but that's how I understand the docs
Answered by aardani
the answer is all yes
View full answer

5 Replies

the answer is all yes
Answer
please do not cross post and respect the rules
Red-naped SapsuckerOP
Thank you for answering
@aardani please do not cross post and respect the rules
Red-naped SapsuckerOP
Oh this is considered cross posting? Thought not since i only linked, but ok, won't do again
@Red-naped Sapsucker Oh this is considered cross posting? Thought not since i only linked, but ok, won't do again
its because you posted the link in #discussions . Usually simple questions like these get answered pretty fast.
or you could just ask these in #discussions and when it gets too complicated/code-related then you can make a post in #help-forum