T
TanStack2w ago
wise-white

Auth best practice: middleware or root beforeload?

I am just curious what people prefer and why they think it is better than the other.
1 Reply
eastern-cyan
eastern-cyan2w ago
Hey @Nicolay , I have seen both - beforeLoad on file-route for redirecting if the user isn't logged like this - middleware on server-functions for accessing protected user data

Did you find this page helpful?