-
Notifications
You must be signed in to change notification settings - Fork 68
Role of the middleware #17
Description
What's the Role of the auth-guard middleware in this implementation?!
since we already check with in __root.tsx with a custom serverfunction and set our auth check with a user being null value
there's no usage of the middleware and it's obsolete.
ideally this middleware would be registered as global using
registerGlobalMiddleware({
middleware: [authMiddleware],
})
and there would be no need to pass context to the route from the root
but this will also run on the root url as well and never init your app because i couldn't find an imertive way to restrict running the middleware from certain route (in this case the localhost:3000) root route
unlike nextjs middleware it has matching function to match only the routes you want to invoke the middleware for, until the same feature gets implemented on tanstack start, the middleware might confuse people and it has no real purpose