Open
Description
Is it possible to define some config in a route:
// routes/authenticated-page.tsx
export const config = {
auth: {
roles: ["admin", "viewer"]
}
}
export default function MyPage(){
return <h1>hello</h1>;
}
And in a middleware, get that config?
// routes/_middleware.tsx
export const handler: MiddlewareHandler = async (request, context) => {
if (context.routeConfig?.auth?.roles) {
await ensureUserHasRoles(context.routeConfig.auth.roles)
}
return await context.next();
}
I can see that the application's configuration is in the context, but not the routes'. However, I do see that the destination is set to either static or route.
Metadata
Metadata
Assignees
Labels
No labels
Activity