Route level middleware #60353
SuhelMakkad
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
middleware
Non-Goals
No response
Background
Current middleware supports most of the cases but it can get tricky to export matcher when we have nested routes.
Proposal
Goals
layout.ts
andpage.ts
, the user can createmiddleware.ts
on every segmentmiddleware
Non-Goals
No response
Background
Current middleware supports most of the cases but it can get tricky to export
matcher
when we have nested routes.Proposal
We can have an additional file as
middleware.ts
which will function the same as the current root levelmiddleware.ts
, but will get triggered for only child routes.for example
/admin/middleware
will get triggered for all the routes under/admin
(/admin/dashboard
,/admin/users
,/admin/blogs
.)Similarly
/user/middleware
will get triggered for all the routes under/user
(/user/profile
,/user/items
.)Beta Was this translation helpful? Give feedback.
All reactions