This property holds a reference to the instance of the Express application that is using the middleware.
This property holds a reference to the instance of the Express application that is using the middleware. res.app is identical to the Request.app property in the request object.
Appends the specified value to the HTTP response header field.
Appends the specified value to the HTTP response header field. If the header is not already set, it creates the header with the specified value. The value parameter can be a string or an array. Note: calling Response.set() after Response.append() will reset the previously-set header value.
Appends the specified value to the HTTP response header field.
Appends the specified value to the HTTP response header field. If the header is not already set, it creates the header with the specified value. The value parameter can be a string or an array. Note: calling Response.set() after Response.append() will reset the previously-set header value.
Sets the HTTP response Content-Disposition header field to “attachment”.
Sets the HTTP response Content-Disposition header field to “attachment”. If a filename is given, then it sets the Content-Type based on the extension name via res.type(), and sets the Content-Disposition “filename=” parameter.
Sets the HTTP response Content-Disposition header field to “attachment”.
Sets the HTTP response Content-Disposition header field to “attachment”. If a filename is given, then it sets the Content-Type based on the extension name via res.type(), and sets the Content-Disposition “filename=” parameter.
Clears the cookie specified by name.
Clears the cookie specified by name. For details about the options object.
Response.cookie()
Clears the cookie specified by name.
Clears the cookie specified by name. For details about the options object.
Response.cookie()
Sets cookie name to value.
Sets cookie name to value. The value parameter may be a string or object converted to JSON.
Sets cookie name to value.
Sets cookie name to value. The value parameter may be a string or object converted to JSON.
Transfers the file at path as an “attachment”.
Transfers the file at path as an “attachment”. Typically, browsers will prompt the user for download. By default, the Content-Disposition header “filename=” parameter is path (this typically appears in the browser dialog). Override this default with the filename parameter.
When an error occurs or transfer is complete, the method calls the optional callback function fn. This method uses res.sendFile() to transfer the file.
Transfers the file at path as an “attachment”.
Transfers the file at path as an “attachment”. Typically, browsers will prompt the user for download. By default, the Content-Disposition header “filename=” parameter is path (this typically appears in the browser dialog). Override this default with the filename parameter.
When an error occurs or transfer is complete, the method calls the optional callback function fn. This method uses res.sendFile() to transfer the file.
Transfers the file at path as an “attachment”.
Transfers the file at path as an “attachment”. Typically, browsers will prompt the user for download. By default, the Content-Disposition header “filename=” parameter is path (this typically appears in the browser dialog). Override this default with the filename parameter.
When an error occurs or transfer is complete, the method calls the optional callback function fn. This method uses res.sendFile() to transfer the file.
Performs content-negotiation on the Accept HTTP header on the request object, when present.
Performs content-negotiation on the Accept HTTP header on the request object, when present. It uses req.accepts() to select a handler for the request, based on the acceptable types ordered by their quality values. If the header is not specified, the first callback is invoked. When no match is found, the server responds with 406 “Not Acceptable”, or invokes the default callback. The Content-Type response header is set when a callback is selected. However, you may alter this within the callback using methods such as res.set() or res.type().
Returns the HTTP response header specified by field.
Returns the HTTP response header specified by field. The match is case-insensitive.
Sends a JSON response.
Sends a JSON response. This method is identical to res.send() with an object or array as the parameter. However, you can use it to convert other values to JSON, such as null, and undefined (although these are technically not valid JSON).
Sends a JSON response.
Sends a JSON response. This method is identical to res.send() with an object or array as the parameter. However, you can use it to convert other values to JSON, such as null, and undefined (although these are technically not valid JSON).
Sends a JSON response with JSONP support.
Sends a JSON response with JSONP support. This method is identical to res.json(), except that it opts-in to JSONP callback support.
Sends a JSON response with JSONP support.
Sends a JSON response with JSONP support. This method is identical to res.json(), except that it opts-in to JSONP callback support.
Joins the links provided as properties of the parameter to populate the response’s Link HTTP header field.
An object that contains response local variables scoped to the request, and therefore available only to the view(s) rendered during that request / response cycle (if any).
An object that contains response local variables scoped to the request, and therefore available only to the view(s) rendered during that request / response cycle (if any). Otherwise, this property is identical to app.locals.
This property is useful for exposing request-level information such as the request path name, authenticated user, user settings, and so on.
Sets the response Location HTTP header to the specified path parameter.
Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code .
Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code . If not specified, status defaults to “302 “Found”.
Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code .
Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code . If not specified, status defaults to “302 “Found”.
Renders a view and sends the rendered HTML string to the client.
Renders a view and sends the rendered HTML string to the client. Optional parameters:
Renders a view and sends the rendered HTML string to the client.
Renders a view and sends the rendered HTML string to the client. Optional parameters:
Renders a view and sends the rendered HTML string to the client.
Renders a view and sends the rendered HTML string to the client. Optional parameters:
Transfers the file at the given path.
Transfers the file at the given path. Sets the Content-Type response HTTP header field based on the filename’s extension. Unless the root option is set in the options object, path must be an absolute path to the file.
Transfers the file at the given path.
Transfers the file at the given path. Sets the Content-Type response HTTP header field based on the filename’s extension. Unless the root option is set in the options object, path must be an absolute path to the file.
Transfers the file at the given path.
Transfers the file at the given path. Sets the Content-Type response HTTP header field based on the filename’s extension. Unless the root option is set in the options object, path must be an absolute path to the file.
Sets the response’s HTTP header field to value.
Sets the response’s HTTP header field to value. To set multiple fields at once, pass an object as the parameter.
Adds the field to the Vary response header, if it is not there already.
The Response 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.