In order to ensure proper access control for the application I was developing, I structured my routing system to cascade down based on user permissions. While this approach made sense from a logical standpoint, I encountered difficulties in implementing it within Express.js.
Specifically, I faced challenges preventing "Project Managers" from accessing the Admin route. Instead, they should only be allowed to navigate through the ManagerRouter and DeveloperRouter paths.
I'm struggling to escape the undesired route. Although the code appears to execute the 'else' statement correctly, it fails to prevent access:
Is there a solution within Express that can address this issue?