Building GET, POST, PUT, DELETE Endpoints

Express makes it easy to build RESTful API endpoints by mapping HTTP methods to route paths.

app.get('/users', ...);
app.post('/users', ...);
app.put('/users/:id', ...);
app.delete('/users/:id', ...);
  • Use request params and body to handle data
  • Respond with JSON using res.json()
← PrevNext →