← Lesson
BitWithBite
Full-Stack · Quick Reference

Lesson 25 — Express REST API Cheat Sheet

Full-Stack
In one line: Express maps HTTP method + path to handler functions, with middleware running in between — CRUD maps to GET/POST/PUT/DELETE.

CRUD → HTTP

Create
POST → 201
Read
GET → 200
Update
PUT/PATCH → 200
Delete
DELETE → 204
Not found
404

Route Example

app.use(express.json()); app.get('/api/courses', (req,res) => res.json(courses)); app.post('/api/courses', (req,res) => { const c = {id: courses.length+1, ...req.body}; courses.push(c); res.status(201).json(c); });