I'm working on MERN project, while on backend I have implement logic for route protection based on user role but now I'm confused if I should do that also in React-frontend or if backend logic is enough?
Thanks in advance
I'm working on MERN project, while on backend I have implement logic for route protection based on user role but now I'm confused if I should do that also in React-frontend or if backend logic is enough?
Thanks in advance
In general, each side should have rules for what users can see what information. On the backend, this is usually some sort of authentication and authorization to enforce access rules to each API route. On the frontend, this is rules for which pages the user can navigate to. These are two different things, but can work together. For example, the frontend might query the back end for information about what the current user has access to then use that to determine which items to put in a menu or which links to render on a page.