statuses
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The "statuses" is a tremendously useful HTTP status utility for Node.js. Its primary role is to provide a list of status codes and the corresponding messages. This list is a compilation from different reputable sources like the IANA Status Code Registry, the Node.js project, the NGINX project, and the Apache HTTP Server project. As JavaScript works continually on enhancing user experience, this module helps in identifying and resolving the HTTP status codes seamlessly.
"statuses" module is pretty easy to incorporate into your Node.js project. Here is a short guide on how to use it:
First, you need to install the package using npm. Run the following command in your terminal:
$ npm install statuses
Second, require the "statuses" module in your JavaScript file:
var status = require('statuses')
The "statuses" function can be used to return the status message string for a known HTTP status code or the numeric status code for a known HTTP status message:
status(403) // Returns 'Forbidden'
status('403') // Returns 'Forbidden'
status('forbidden') // Returns 403
status('Forbidden') // Returns 403
"statuses" module provides several properties that can be helpful for handling HTTP statuses, for instance:
status['not found'] // Returns 404
status.empty[204] // Returns true
status.message[404] // Returns 'Not Found'
status.redirect[301] // Returns true
status.retry[503] // Returns true
The documentation for the "statuses" package can be found within the readme file in its repository on GitHub. The repository's URL is git+https://github.com/jshttp/statuses.git. It provides a comprehensive introduction to the package, including installation instructions, API usage examples, and other useful information.