res.sendStatus(statusCode)
Sets the response HTTP status code to statusCode
and send its string representation as the response body.
1 2 3 4 | res.sendStatus(200); // equivalent to res.status(200).send('OK') res.sendStatus(403); // equivalent to res.status(403).send('Forbidden') res.sendStatus(404); // equivalent to res.status(404).send('Not Found') res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error') |
If an unsupported status code is specified, the HTTP status is still set to statusCode
and the string version of the code is sent as the response body.
1 | res.sendStatus(2000); // equivalent to res.status(2000).send('2000') |
Please login to continue.