A function that wraps up the fetch API with opinionated handling of the Response Promise which effectively removes all boiler plate from making REST requests to back-end APIs
npm install fetch-response-handler

Fetch Response Handler is wrapper for the javascript Fetch API which provides expressive and idiomatic handling of network errors, client errors HTTP status = 4, server errors HTTP status = 5 and successful responses as either the native Response or as a JSON object for responses with Content-Type = application/json.
It also provides support for default error handling and cancelling requests using AbortControllers.
It exists to improve the expressiveness and idiomacity of production web applications using the Fetch API.
```
npm install fetch-response-handler
`javascript
// Import the fetchResponseHandler function from the fetch-response-handler package in a module
import {fetchResponseHandler} from "fetch-response-handler";
// OR in a script
var fetchResponseHandler = require("./src/fetch-response-handler.js").fetchResponseHandler;
`
`javascript``
// Fetch JSON payload from URL
fetchResponseHandler(
.onSuccessJson(json => {
.fetch();
If you'd like to contribute to this project feel free to fork the repository and use a feature branch. Pull requests are warmly welcome
The code in this project is under the MIT licence