README
redstone-isomorphic-fetch
Redstone's isomorphic-fetch is an implementation of isomorphic-fetch
It adds fetch
as global so its API is consistent between client and server. It uses standard fetch() method on client's side and undici - which is a http client written for Node.js - on server's side.
Installation
NPM
npm install --save redstone-isomorphic-fetch
YARN
yarn add redstone-isomorphic-fetch
Bower
bower install --save redstone-isomorphic-fetch
Usage
import "isomorphic-fetch";
fetch("//api.redstone.finance")
.then(function (response) {
if (response.status >= 400) {
throw new Error("Bad response from server");
}
return response.json();
})
.then(function (data) {
console.log(data);
});