When a request arrives at the server, it first checks if the user is logged in using checkAuth middleware. If not logged in, the user is redirected to login. If logged in, the server checks the user's role. For admin routes, checkAdmin middleware ensures the user has the admin role. If the user is not an admin, access is blocked with a 403 Forbidden response. For user routes, only login is required, so any logged-in user can access. This layered check protects routes based on user roles. The execution table shows different scenarios: not logged in users get redirected, logged-in users with wrong roles get blocked, and correct roles get access. Variables like user login status and role change as requests are processed. This method keeps admin routes secure and user routes accessible to all logged-in users.