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

2.0.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @cley_faye/http-codes-consts

Weekly Downloads

50

Version

2.0.0

License

MIT

Unpacked Size

16.5 kB

Total Files

5

Last publish

Collaborators

  • cley_faye