A lightweight, categorized library of HTTP status codes for use in Node.js and JavaScript projects. Simplifies response handling by providing easy access to all standard HTTP status codes.
Install via npm:
npm i http-codes-helperImport the package and use the status codes in your project to improve readability.
const { Information, Success, Redirection, ClientError, ServerError } = require('@shubhampaul9991234/http-status-map');
// Example usage
console.log(Success.ok); // Outputs: 200
console.log(ClientError.notFound); // Outputs: 404
console.log(ServerError.internalServerError); // Outputs: 500The package groups HTTP status codes into the following categories:
- 1xx - Informational: Interim responses like 100 Continue
- 2xx - Success: Indicates successful responses like 200 OK
- 3xx - Redirection: Redirection responses like 301 Moved Permanently
- 4xx - Client Error: Client errors like 404 Not Found
- 5xx - Server Error: Server errors like 500 Internal Server Error
| Code | Description |
|---|---|
| 100 | Continue |
| 101 | Switching Protocols |
| 102 | Processing |
| 103 | Early Hints |
| Code | Description |
|---|---|
| 200 | OK |
| 201 | Created |
| 202 | Accepted |
| 203 | Non-Authoritative Information |
| 204 | No Content |
| 205 | Reset Content |
| 206 | Partial Content |
| 207 | Multi-Status |
| 208 | Already Reported |
| 226 | IM Used |
| Code | Description |
|---|---|
| 300 | Multiple Choices |
| 301 | Moved Permanently |
| 302 | Found |
| 303 | See Other |
| 304 | Not Modified |
| 305 | Use Proxy |
| 306 | (Unused) |
| 307 | Temporary Redirect |
| 308 | Permanent Redirect |
| Code | Description |
|---|---|
| 400 | Bad Request |
| 401 | Unauthorized |
| 402 | Payment Required |
| 403 | Forbidden |
| 404 | Not Found |
| 405 | Method Not Allowed |
| 406 | Not Acceptable |
| 407 | Proxy Authentication Required |
| 408 | Request Timeout |
| 409 | Conflict |
| 410 | Gone |
| 411 | Length Required |
| 412 | Precondition Failed |
| 413 | Payload Too Large |
| 414 | URI Too Long |
| 415 | Unsupported Media Type |
| 416 | Range Not Satisfiable |
| 417 | Expectation Failed |
| 418 | I'm a Teapot |
| 421 | Misdirected Request |
| 422 | Unprocessable Entity |
| 423 | Locked |
| 424 | Failed Dependency |
| 425 | Too Early |
| 426 | Upgrade Required |
| 428 | Precondition Required |
| 429 | Too Many Requests |
| 431 | Request Header Fields Too Large |
| 451 | Unavailable For Legal Reasons |
| Code | Description |
|---|---|
| 500 | Internal Server Error |
| 501 | Not Implemented |
| 502 | Bad Gateway |
| 503 | Service Unavailable |
| 504 | Gateway Timeout |
| 505 | HTTP Version Not Supported |
| 506 | Variant Also Negotiates |
| 507 | Insufficient Storage |
| 508 | Loop Detected |
| 510 | Not Extended |
| 511 | Network Authentication Required |