Middleware.js use problem
Answered
Spotted Rail posted this in #help-forum
Original message was deleted.
Answered by Jimmy Barton
Use the file middleware.ts (or .js) in the root of your project to define Middleware. For example, at the same level as pages or app, or inside src if applicable.
https://nextjs.org/docs/app/building-your-application/routing/middleware
@Spotted Rail I think you're supposed to put that middleware file inside
src
if you're using src
folder.2 Replies
Use the file middleware.ts (or .js) in the root of your project to define Middleware. For example, at the same level as pages or app, or inside src if applicable.
https://nextjs.org/docs/app/building-your-application/routing/middleware
@Spotted Rail I think you're supposed to put that middleware file inside
src
if you're using src
folder.Answer