svix-fetch is a fork of Matthew Andrew's wonderful WHATWG Fetch polyfill for node and bowserfy: isomorphic-fetch.
The main purpose of this fork is to enable keepalives when running in a node context.
Unless you have a specific need for this functionality we recommend using isomorphic-fetch.
npm install --save svix-fetch
bower install --save svix-fetch
require('svix-fetch');
fetch('//offline-news-api.herokuapp.com/stories')
.then(function(response) {
if (response.status >= 400) {
throw new Error("Bad response from server");
}
return response.json();
})
.then(function(stories) {
console.log(stories);
});
This code is licenced under the MIT licence. Based on isomorphic-fetch by matthew-andrews.
- isomorphic-fetch.
- cross-fetch
- Using node-fetch and the Fetch polyfill directly (or from polyfill.io, or relying on the browser's implementation of the Fetch API).