ProjectsCore· 150 min read

Project: Build a REST API

Build a complete, well-structured REST API with full CRUD, validation and error handling.

What you will learn

  • Build a full CRUD API
  • Add validation and error handling
  • Structure the project cleanly

The brief

Build a REST API for a resource of your choice (notes, books, tasks, products). Use an array as the data store for now — MongoDB comes next.

Requirements

  • All five endpoints: list all, get one, create, update, delete.
  • express.json() middleware and a request logger.
  • Input validation (reject bad/missing data with 400).
  • Correct status codes (200, 201, 404, 400).
  • A catch-all 404 and a central error handler.
  • CORS enabled so a front-end can call it.

Tip: Test every endpoint with a tool like Postman or the Thunder Client VS Code extension. Confirm each returns the right data and status code before moving on.

Note: Keep routes tidy — as the API grows, split routes into separate files with Express Router. A clean structure pays off fast.

✍️ Practice

  1. Build the full CRUD API meeting all six requirements.
  2. Test every endpoint and confirm the status codes.

🏠 Homework

  1. Split your routes into a separate router file and add one more validated field.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →