Request and Response

The Request and Response Objects

Neither argument a handler receives is an Express 24,430 invention: req is Node's http.IncomingMessage and res its http.ServerResponse (Node.js). Express inserts its own prototype into each chain before your handler runs, so req.socket and res.end() still work, and on top of them you get req.params, req.body, res.json() and some forty more helpers. When one does not fit, drop to the Node API underneath.

The two objects a handler receives, and the layers that decorate them
The two objects a handler receives, and the layers that decorate them

Express 5 removed or renamed several Express 4 helpers, so every signature below was checked against 5.2.1.

Subsections