Recall & Review
beginner
What is the main purpose of a user login flow in an Express app?
To verify a user's identity by checking their credentials and then allowing access to protected parts of the app.
Click to reveal answer
beginner
Which Express middleware is commonly used to parse form data sent by a login form?
The
express.urlencoded() middleware parses URL-encoded form data so you can access it via req.body.Click to reveal answer
intermediate
Why do we use sessions or tokens after a user logs in?
To remember the user’s login state across different pages or requests without asking them to log in again each time.
Click to reveal answer
intermediate
What is the role of password hashing in a login flow?
Password hashing securely transforms the password so it’s not stored in plain text, protecting user data if the database is compromised.
Click to reveal answer
intermediate
In Express, how do you protect routes so only logged-in users can access them?
By creating middleware that checks if the user is authenticated before allowing access to the route, redirecting or blocking if not.
Click to reveal answer
Which method in Express is used to handle POST requests from a login form?
✗ Incorrect
POST requests are handled with app.post() to receive form data securely.
What does
req.body contain in a login route?✗ Incorrect
req.body holds the data sent by the user, like username and password.Why should passwords be hashed before storing in the database?
✗ Incorrect
Hashing protects passwords by storing a scrambled version that can’t be reversed.
What is a common way to keep a user logged in across multiple requests?
✗ Incorrect
Sessions or tokens remember the user’s login state safely.
Which middleware can you use to protect routes in Express?
✗ Incorrect
Custom middleware can check if a user is logged in before allowing access.
Describe the steps involved in a typical user login flow in an Express app.
Think about what happens from form submission to access granted.
You got /6 concepts.
Explain how you would protect a route so only logged-in users can access it in Express.
Focus on middleware role and checking user state.
You got /4 concepts.