JSPM

  • Created
  • Published
  • Downloads 5491056
  • Score
    100M100P100Q265344F
  • License MIT

Constants enumerating the HTTP status codes. Based on the Java Apache HttpStatus API.

Package Exports

  • http-status-codes
  • http-status-codes/index

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-status-codes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

http-status-codes

Constants enumerating the HTTP status codes. Based on the Java Apache HttpStatus API.

All status codes defined in RFC1945 (HTTP/1.0), RFC2616 (HTTP/1.1), RFC2518 (WebDAV) and RFC6585 (Additional HTTP Status Codes) are supported.

Installation

npm install http-status-codes

Usage (express 4.x)

var HttpStatus = require('http-status-codes');

response
    .status(HttpStatus.OK)
    .send('ok');

response
    .status(HttpStatus.INTERNAL_SERVER_ERROR)
    .send({
        error: HttpStatus.getStatusText(HttpStatus.INTERNAL_SERVER_ERROR)
    });