Practice & Assessment
Test your understanding of Building REST APIs with Express.js
Multiple Choice Questions
6What is the purpose of express.json() middleware in an Express application?
What is the correct signature for an Express error-handling middleware?
In Express.js, what does calling next() inside a middleware do?
Which status code should Express return when a Mongoose duplicate key error (code 11000) occurs?
What is the benefit of the asyncHandler wrapper utility in Express?
What does Supertest allow you to do in API testing?
Mini Project
Blog REST API with Full CRUD and Nested Resources
Build a production-structured Blog REST API with User (author), Post, and Comment resources. Implement full CRUD for Posts, nested Comments on Posts, query parameters for filtering by author, tag, and date range, and sorting. Use the scalable project structure, Joi validation, centralized error handling, Morgan logging, environment variables with dotenv, and a minimum 80% test coverage. Include a README with setup instructions and curl examples for every endpoint.
