http-response-status-codes
v1.0.0
Published
Constants for HTTP response status codes that indicate whether a specific HTTP request has been successfully completed
Downloads
8
Readme
http-response-status-codes
Constants for standard HTTP response status codes that indicate whether a specific HTTP request has been successfully completed.
Based on MDN web docs.
Installation
npm i http-response-status-codes
Usage (express.js example)
const HTTP_STATUS = require('http-response-status-codes');
app.get('/ping', (req, res) => {
res.status(HTTP_STATUS.SUCCESS.OK).send('Pong');
});
app.get('/account', (req, res) => {
res.status(HTTP_STATUS.CLIENT.UNAUTHORIZED).send('Pong');
});
app.get('/calculate', (req, res) => {
res.status(HTTP_STATUS.SERVER.INTERNAL_SERVER_ERROR).send('Pong');
});