Recall & Review
beginner
What is the main purpose of the
app.js file in an Express application?The
app.js file sets up the Express app, configures middleware, routes, and error handling. It is the central place where the app is created and configured.Click to reveal answer
beginner
Why do Express apps often have a
routes folder?The
routes folder organizes route handlers by grouping related URL paths and their logic. This keeps the code clean and easier to maintain.Click to reveal answer
intermediate
What is the role of middleware in Express application structure?
Middleware functions run during the request-response cycle. They can modify requests, responses, or end the cycle. Middleware helps add features like logging, parsing, and authentication.
Click to reveal answer
beginner
How does the
public folder fit into an Express app structure?The
public folder holds static files like images, CSS, and JavaScript that the browser can access directly. Express serves these files using built-in middleware.Click to reveal answer
beginner
What is the purpose of the
views folder in an Express app?The
views folder contains template files that generate HTML dynamically. These templates are rendered by the app to send web pages to users.Click to reveal answer
Which file usually starts the Express server?
✗ Incorrect
The
server.js file typically imports the app and starts the server listening on a port.Where should you put your route definitions in an Express app?
✗ Incorrect
Routes are organized in the
routes folder to keep the app structure clean.What does middleware do in Express?
✗ Incorrect
Middleware functions process requests and responses during the app's request-response cycle.
Which folder contains static assets like images and CSS?
✗ Incorrect
The
public folder holds static files served directly to the browser.What is the purpose of the
views folder?✗ Incorrect
The
views folder contains templates that generate HTML pages dynamically.Describe the typical folder structure of an Express application and the role of each main folder.
Think about where you put code for routes, templates, and static files.
You got /5 concepts.
Explain how middleware fits into the Express application structure and why it is important.
Middleware is like helpers that run between receiving a request and sending a response.
You got /4 concepts.