# Basic Routes — Express.js Fundamentals: Routing, Middleware and APIs

Source: https://www.skillbyai.com/en/expressjs/ex-basic-routes

> Map GET, POST, PUT and DELETE routes to CRUD operations and order routes from specific to general.

## 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.

```javascript
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.
