create-nodeapi-backend
Version:
A powerful Node.js backend boilerplate with Express, MongoDB, Firebase, JWT auth, Nodemailer, cron jobs, input validation (Joi), and serverless support for Vercel. Scaffold a full-featured API backend in seconds.
69 lines (66 loc) • 2.35 kB
JavaScript
const httpStatus = require("http-status");
const statusCodeMap = {
100: httpStatus.CONTINUE,
101: httpStatus.SWITCHING_PROTOCOLS,
102: httpStatus.PROCESSING,
103: httpStatus.EARLY_HINTS,
200: httpStatus.OK,
201: httpStatus.CREATED,
202: httpStatus.ACCEPTED,
203: httpStatus.NON_AUTHORITATIVE_INFORMATION,
204: httpStatus.NO_CONTENT,
205: httpStatus.RESET_CONTENT,
206: httpStatus.PARTIAL_CONTENT,
207: httpStatus.MULTI_STATUS,
208: httpStatus.ALREADY_REPORTED,
226: httpStatus.IM_USED,
300: httpStatus.MULTIPLE_CHOICES,
301: httpStatus.MOVED_PERMANENTLY,
302: httpStatus.FOUND,
303: httpStatus.SEE_OTHER,
304: httpStatus.NOT_MODIFIED,
305: httpStatus.USE_PROXY,
307: httpStatus.TEMPORARY_REDIRECT,
308: httpStatus.PERMANENT_REDIRECT,
400: httpStatus.BAD_REQUEST,
401: httpStatus.UNAUTHORIZED,
402: httpStatus.PAYMENT_REQUIRED,
403: httpStatus.FORBIDDEN,
404: httpStatus.NOT_FOUND,
405: httpStatus.METHOD_NOT_ALLOWED,
406: httpStatus.NOT_ACCEPTABLE,
407: httpStatus.PROXY_AUTHENTICATION_REQUIRED,
408: httpStatus.REQUEST_TIMEOUT,
409: httpStatus.CONFLICT,
410: httpStatus.GONE,
411: httpStatus.LENGTH_REQUIRED,
412: httpStatus.PRECONDITION_FAILED,
413: httpStatus.PAYLOAD_TOO_LARGE,
414: httpStatus.URI_TOO_LONG,
415: httpStatus.UNSUPPORTED_MEDIA_TYPE,
416: httpStatus.RANGE_NOT_SATISFIABLE,
417: httpStatus.EXPECTATION_FAILED,
418: httpStatus.IM_A_TEAPOT,
421: httpStatus.MISDIRECTED_REQUEST,
422: httpStatus.UNPROCESSABLE_ENTITY,
423: httpStatus.LOCKED,
424: httpStatus.FAILED_DEPENDENCY,
425: httpStatus.TOO_EARLY,
426: httpStatus.UPGRADE_REQUIRED,
428: httpStatus.PRECONDITION_REQUIRED,
429: httpStatus.TOO_MANY_REQUESTS,
431: httpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE,
451: httpStatus.UNAVAILABLE_FOR_LEGAL_REASONS,
500: httpStatus.INTERNAL_SERVER_ERROR,
501: httpStatus.NOT_IMPLEMENTED,
502: httpStatus.BAD_GATEWAY,
503: httpStatus.SERVICE_UNAVAILABLE,
504: httpStatus.GATEWAY_TIMEOUT,
505: httpStatus.HTTP_VERSION_NOT_SUPPORTED,
506: httpStatus.VARIANT_ALSO_NEGOTIATES,
507: httpStatus.INSUFFICIENT_STORAGE,
508: httpStatus.LOOP_DETECTED,
510: httpStatus.NOT_EXTENDED,
511: httpStatus.NETWORK_AUTHENTICATION_REQUIRED
};
module.exports = statusCodeMap;