You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A route to run before a route path similar to layout for pages
It can help in custom logic for few route handlers
Authentication and Authorisation will be easy
router.ts runs before the api called at route.ts
Same as route groups we can have router to wrap all APIs for nested routes
Non-Goals
No response
Background
The current alternative is middleware.ts in which the code become verbose and multiple custom cases cannot be done. Using this can specify what to do before an api call.
Proposal
This feature will be same as the app router page and layouts are implemented. The layout can wrap a whole bunch of route similarly am api route can also be wrapped with router for specific route behaviour before calling.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
router.ts
runs before the api called atroute.ts
Non-Goals
No response
Background
The current alternative is
middleware.ts
in which the code become verbose and multiple custom cases cannot be done. Using this can specify what to do before an api call.Proposal
This feature will be same as the app router page and layouts are implemented. The layout can wrap a whole bunch of route similarly am api route can also be wrapped with router for specific route behaviour before calling.
Beta Was this translation helpful? Give feedback.
All reactions