Utility to interact with HTTP status code in Node.js
Clone or download
Latest commit 852de79 Nov 14, 2018


Build Status

HTTP Status code for Node

Utility to interact with HTTP status code.


Once you require this module, you may call it with either an HTTP code or a message name. With an HTTP code, you will get the message name while with a message name you will get an HTTP code. Simple.

Additionally, HTTP code names and messages are respectively accessible with the name "{code}_NAME" and "{code}_MESSAGE".

Extra status code are also made available. They are grouped by categories. Specific properties are exported by http-status under the property extra followed by the category name. Also, extra code are merge with regular status code and made available as modules available inside http-status/lib/{category}. Available categories are:

  • unofficial
    This represent a list of codes which are not specified by any standard.
  • iis
    Microsoft's Internet Information Services (IIS) web server expands the 4xx error space to signal errors with the client's request.
  • nginx
    The NGINX web server software expands the 4xx error space to signal issues with the client's request.
  • cloudflare
    Cloudflare's reverse proxy service expands the 5xx series of errors space to signal issues with the origin server.


This module is very simple. A documentation would be more complicate than reading the original code.

API sample

const status = require('http-status');
// Print "Internal Server Error"
// Print 500
// Print "A generic error message, given when an unexpected condition was encountered and no more specific message is suitable."

Extra sample

// Accessing property from the NGINX category
const status = require('http-status');
// Accessing default HTTP status merged with NGINX status
const status = require('http-status/lib/nginx');

Express sample

const express = require('express'),
      redis = require('redis'),
      status = require('http-status');
// New Express HTTP server
const app = express.createServer();
// Regster a route
app.get('/', function (req, res) {
  const client = redis.createClient();
  client.ping(function (err, msg) {
    if (err) {
      return res.send(status.INTERNAL_SERVER_ERROR);
    res.send(msg, status.OK);
// Start the HTTP server


This package is developed by Adaltas.