Skip to content

Role of the middleware #17

@mapsgeek

Description

@mapsgeek

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions