Next.js Discord

Discord Forum

Middleware.tsx

Answered
Varun posted this in #help-forum
Open in Discord
Avatar
I don't see a middleware.tsx created in my project and generally I read that it is supposed to be on the same level as the pages folder. Would the equivalent of my pages folder be app?
Image
Answered by Ray
it should be at the root of directory
/middleware.ts
View full answer

3 Replies

Avatar
it should be at the root of directory
/middleware.ts
Answer
Avatar
or src/middleware.ts if you are using src folder
Avatar
thanks!