The res object represents the HTTP response that an Express app sends when it gets an HTTP request.
In this documentation and by convention,
the object is always referred to as res (and the HTTP request is req) but its actual name is determined
by the parameters to the callback function in which you’re working.
For example:
app.get('/user/:id', function (req, res) {
res.send('user '+ req.params.id);
});
But you could just as well have:
app.get('/user/:id', function (request, response) {
response.send('user '+ request.params.id);
});
The res object is an enhanced version of Node’s own response object
and supports all built-in fields and methods.
Properties
{% include api/en/4x/res-app.md %}
{% include api/en/4x/res-headersSent.md %}
{% include api/en/4x/res-locals.md %}
Methods
{% include api/en/4x/res-append.md %}
{% include api/en/4x/res-attachment.md %}
{% include api/en/4x/res-cookie.md %}
{% include api/en/4x/res-clearCookie.md %}
{% include api/en/4x/res-download.md %}
{% include api/en/4x/res-end.md %}
{% include api/en/4x/res-format.md %}
{% include api/en/4x/res-get.md %}
{% include api/en/4x/res-json.md %}
{% include api/en/4x/res-jsonp.md %}
{% include api/en/4x/res-links.md %}
{% include api/en/4x/res-location.md %}
{% include api/en/4x/res-redirect.md %}
{% include api/en/4x/res-render.md %}
{% include api/en/4x/res-req.md %}
{% include api/en/4x/res-send.md %}
{% include api/en/4x/res-sendFile.md %}
{% include api/en/4x/res-sendStatus.md %}
{% include api/en/4x/res-set.md %}
{% include api/en/4x/res-status.md %}
{% include api/en/4x/res-type.md %}
{% include api/en/4x/res-vary.md %}