LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

How do you send a JSON response from an Express route handler?

Call res.json(), which serializes the object and sets the Content-Type: application/json header for you.

app.get('/api/user', (req, res) => {
  res.json({ id: 1, name: 'Alice' });
});

Sets Content-Type: application/json header automatically.

For status codes, chain: res.status(201).json(data)

From Quiz: WEBT / Backend Integration | Updated: Jun 20, 2026