1.0.0 • Published 7 months ago
als-http-error-status v1.0.0
ALS HTTP Error Status
A simple and lightweight utility for accessing HTTP error codes and their corresponding status messages.
Installation
npm install als-http-error-status
Usage
const errorsCodes = require('als-http-error-status');
// Retrieve the status message for a specific HTTP error code
const message = errorsCodes.get(404); // 'Not Found'
console.log(`Error 404: ${message}`);
Features
- Provides a ready-to-use Map of HTTP status codes and their standard messages.
- Lightweight and easy to integrate into any project.
- Covers all standard HTTP error status codes.
API Reference
The package exports a Map
object containing the HTTP status codes as keys and their corresponding messages as values.
errorsCodes
Type: Map<number, string>
Example
errorsCodes.get(500); // 'Internal Server Error'
errorsCodes.has(418); // true
for (const [code, message] of errorsCodes) {
console.log(`${code}: ${message}`);
}
1.0.0
7 months ago