devnotes.

Response Complete Reference

A quick reference for the res object's most commonly used properties and methods.

Properties

PropertyDescription
res.appReference to the current Express app instance.
res.headersSentWhether response headers have already been sent.
res.localsObject of variables scoped to the current request.

Methods

MethodDescription
res.append()Appends a value to a response header.
res.attachment()Marks the response as a downloadable attachment.
res.cookie()Sets a cookie.
res.clearCookie()Clears a previously set cookie.
res.download()Transfers a file as a downloadable attachment.
res.end()Ends the response process.
res.format()Performs content negotiation on the Accept header.
res.get()Reads a response header's current value.
res.json()Sends a JSON response.
res.jsonp()Sends a JSON response with JSONP support.
res.links()Sets Link response headers.
res.location()Sets the Location response header.
res.redirect()Redirects the client to another URL.
res.render()Renders a view and sends the resulting HTML.
res.send()Sends a response of any type.
res.sendFile()Sends a file based on its path and extension.
res.sendStatus()Sets the status code and sends its text as the body.
res.set()Sets one or more response headers.
res.status()Sets the HTTP status code.
res.type()Sets the Content-Type header based on a MIME lookup.
res.vary()Adds a field to the Vary response header.

Keep this table handy for quickly recalling a specific res property or method.

Response Complete Reference | DevNotes