An open API service indexing awesome lists of open source software.

https://github.com/maifeeulasad/http-response-details


https://github.com/maifeeulasad/http-response-details

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

          

# ๐Ÿ“ก http-response-details [![NPM Downloads][downloads-image]][downloads-url]

[downloads-image]: https://img.shields.io/npm/dm/http-response-details.svg
[downloads-url]: https://npmcharts.com/compare/http-response-details?minimal=true

## Example (pure Node.js) ๐Ÿš€:
```javascript
const httpCodes = require("http-response-details");

console.log(httpCodes["400"]); // ๐Ÿšซ Bad Request
console.log(httpCodes["201"]); // โœ… Created
```

## Example (React.js) โš›๏ธ:
```javascript
import React from "react";
const httpCodes = require("http-response-details");

class App extends React.Component {
constructor(props) {
super(props);
//console.log("test");
//console.log(httpCodes);
console.log(httpCodes["400"]); // ๐Ÿšซ Bad Request
console.log(httpCodes["201"]); // โœ… Created
//or inside other life-cycle method or anywhere
}

render() {
return

;
}
}

export default App;
```

## Try it on CodeSandbox.io ๐Ÿงช:
[https://codesandbox.io/s/http-response-details-example-39lhm?file=/src/App.js](https://codesandbox.io/s/http-response-details-example-39lhm?file=/src/App.js)