2.0.0 • Published 3 years ago

@cley_faye/http-codes-consts v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

List of HTTP codes as constants

This is a simple list, to avoid magic numbers in the code as well as add a bit of safety when using TypeScript.

The list of codes is taken from the IANA.

Installation

This is on npmjs:

npm install @cley_faye/http-codes-consts

Usage

Constants are available as the default export:

import HttpCodes from "@cley_faye/http-codes-consts";
console.log(HttpCodes.NotFound); // Output 404
console.log(HttpCodes.NOT_FOUND); // Output 404

Names are available in both camel-case and uppercase separated with an underline.

Caveats

Unfortunately, as this is generated from a "serious" CSV source, the "I'm a Teapot" error is not available.