protected routes vite, express

Hello! So I have an express app setup with better-auth under localhost:3000 that servers as my auth endpoint / api. And a frontend vite app on localhost:5173. If I would go a head an create something like a localhost:5173/dashboard, how can I make the dashboard protected? Do I just check if the user has session data when /dashboard is mounted on the client and redirect him back to my homepage if they dont? Or should I create an endpoint that verifys it for me? I cant use middleware because I do routing on my frontend obv
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?