1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 08:10:18 +00:00
musix-oss/node_modules/isomorphic-fetch
2019-10-10 16:43:04 +03:00
..
node_modules/node-fetch Updated 2019-10-10 16:43:04 +03:00
test Updated 2019-10-10 16:43:04 +03:00
.editorconfig Updated 2019-10-10 16:43:04 +03:00
.jshintrc Updated 2019-10-10 16:43:04 +03:00
.npmignore Updated 2019-10-10 16:43:04 +03:00
.travis.yml Updated 2019-10-10 16:43:04 +03:00
bower.json Updated 2019-10-10 16:43:04 +03:00
fetch-bower.js Updated 2019-10-10 16:43:04 +03:00
fetch-npm-browserify.js Updated 2019-10-10 16:43:04 +03:00
fetch-npm-node.js Updated 2019-10-10 16:43:04 +03:00
LICENSE Updated 2019-10-10 16:43:04 +03:00
package.json Updated 2019-10-10 16:43:04 +03:00
README.md Updated 2019-10-10 16:43:04 +03:00

isomorphic-fetch Build Status

Fetch for node and Browserify. Built on top of GitHub's WHATWG Fetch polyfill.

Warnings

  • This adds fetch as a global so that its API is consistent between client and server.
  • You must bring your own ES6 Promise compatible polyfill, I suggest es6-promise.

Installation

NPM

npm install --save isomorphic-fetch es6-promise

Bower

bower install --save isomorphic-fetch es6-promise

Usage

require('es6-promise').polyfill();
require('isomorphic-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);
	});

License

All open source code released by FT Labs is licenced under the MIT licence. Based on the fine work by jxck.