Setting the Status

You need to set the HTTP status for a response if it is something other than 200. It is important to send the correct status response so that the browser or other applications can handle the HTTP response correctly. To set the status response, use the status(number) method, where the number parameter is the HTTP response status defined in the HTTP spec.

For example, the following lines set different statuses:

res.status(200); // OK
res.status(300); // Redirection
res.status(400); // Bad Request
res.status(401); // Unauthorized
res.status(403); // Forbidden
res.status(500); // Server Error

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.185.155