Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/harshzalavadiya/friendly-http-status
Translates http status code to friendly object containing description and emoji
https://github.com/harshzalavadiya/friendly-http-status
description emoji http-status-code status-code
Last synced: 2 months ago
JSON representation
Translates http status code to friendly object containing description and emoji
- Host: GitHub
- URL: https://github.com/harshzalavadiya/friendly-http-status
- Owner: harshzalavadiya
- License: mit
- Created: 2019-10-13T13:00:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-27T23:41:54.000Z (2 months ago)
- Last Synced: 2024-11-28T04:05:18.290Z (2 months ago)
- Topics: description, emoji, http-status-code, status-code
- Language: TypeScript
- Homepage:
- Size: 482 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Friendly HTTP Status
Translates HTTP status code to minimal friendly object containing description and emoji 😃
![GitHub Actions Status](https://github.com/harshzalavadiya/friendly-http-status/workflows/NodeJS/badge.svg)
![NPM](https://img.shields.io/npm/v/friendly-http-status.svg)
![gzip](https://badgen.net/bundlephobia/minzip/friendly-http-status)## 🔧 Installation
```sh
npm i friendly-http-status
```## 📦 Usage
```javascript
import { getFriendlyError } from "friendly-http-status";console.log(getFriendlyError(404));
```## 👀 Response
`getFriendlyError` always returns json object with following property even if code unknown it will return unknown error object
```json
{
"emoji": "❓",
"message": "Not Found",
"description": "The requested page could not be found but may be available again in the future."
}
```## 🤠 Credits
- Emoji dataset is taken from [http-status-extra](https://github.com/aasaam/http-status-extra) and stripped to minimal
- [microbundle](https://github.com/developit/microbundle) for packaging
- [TypeScript](https://github.com/microsoft/TypeScript)