Lesson 4 / 23
Basic Routes
GET, POST, PUT and DELETE map straight to HTTP verbs.
One method per verb
Express exposes app.get, app.post, app.put, app.delete (and more) — each matches requests with that HTTP method.
CRUD-style routes
A typical resource exposes four routes for list, create, update and delete.
app.get('/items', (req, res) => res.json([]));
app.post('/items', (req, res) => res.status(201).send('created'));
app.put('/items/:id', (req, res) => res.send('updated'));
app.delete('/items/:id', (req, res) => res.send('deleted'));Order matters
Express matches routes top to bottom and stops at the first match — put more specific routes before generic ones.