A utility for generating user-friendly messages based on HTTP status codes and message tone.
npm install http-status-messagehttp-status-message is an npm package that provides a collection of status code messages tailored for various tones, suitable for displaying in web applications, APIs, or any other software that communicates HTTP status codes to users.
You can install http-status-message using npm:
``javascript`
npm install http-status-message
`javascript
const { getStatusMessage } = require('http-status-message');
// or
import { getStatusMessage } from 'http-status-message'; // ES6 import syntax
// Get a formal message along with corresponding emoji for status code 404
const message = getStatusMessage(404, 'formal');
console.log(message);
`
Returns an object containing a message string and an emoji corresponding to the given HTTP status code and tone.
- statusCode (number): The HTTP status code (e.g., 200, 404, 500).messageTone
- (string): The tone of the message. formal
- Available options: , informal, straightforward, technical, funny, empathetic, educational, short`.
Contributions are welcome! If you have suggestions for improvements, new features, or encounter any issues, please open an issue or submit a pull request.
This project is licensed under the MIT License.