Best approach to having protected routes in SolidJs?
Hello, I'm working on securing certain routes in my application to ensure they are protected if a user is not logged in. There are about 10-15 pages that need to be restricted. I'm currently using Better-Auth for authentication and have switched to client-side rendering only for now.
6 Replies
Also I am using an external API, and using axios to fetch data
Typically you want to create a route layout which verifies authentication and redirects to
/login
when not authenticated while all the protected routes are nested within the “protected” layout.Auth - SolidDocs
Documentation for SolidJS, the signals-powered UI framework

Middleware - SolidDocs
Documentation for SolidJS, the signals-powered UI framework