Express 5 · Routing

Send a status and JSON

Set the status code and send a JSON response.

res.status(404).json({ error: "Not found" });

Official Express 5 documentation

More routing commands

All routing commands · Express 5 cheatsheet

Was this page helpful?