@status/codes
TypeScript icon, indicating that this package has built-in type declarations

1.6.2 • Public • Published

Status Codes

npm (scoped) NPM

A collection of status code enums.

Available Enums

  • Apache
  • Auth0
  • Braintree
  • Cloudflare
  • FirebaseAuth
  • FTP
  • Http
  • IIS
  • IRC
  • Mocha
  • MongoDB
  • Mongoose *wip
  • Nginx
  • Node
  • Twitter

Install

npm:
npm install @status/codes

yarn:
yarn add @status/codes

Example Usage

import { Http } from '@status/codes';

export class NotFoundError extends Error {
  readonly code = Http.NotFound;
}

Use with express:

const { Http } = require('@status/codes');

create(request, response) {
  Model.create(request.body)
    .then(instance => response.status(Http.Created).json(instance))
    .catch(error => response.status(Http.Conflict).json(error))
}

Dependencies (0)

    Dev Dependencies (18)

    Package Sidebar

    Install

    npm i @status/codes

    Weekly Downloads

    4,556

    Version

    1.6.2

    License

    MIT

    Unpacked Size

    134 kB

    Total Files

    37

    Last publish

    Collaborators

    • jfrazx