Illia Kozyr c722a49f64 React Project DONE | 2 rokov pred | |
---|---|---|
.. | ||
test | 2 rokov pred | |
.editorconfig | 2 rokov pred | |
.jshintrc | 2 rokov pred | |
.npmignore | 2 rokov pred | |
.travis.yml | 2 rokov pred | |
LICENSE | 2 rokov pred | |
README.md | 2 rokov pred | |
bower.json | 2 rokov pred | |
fetch-bower.js | 2 rokov pred | |
fetch-npm-browserify.js | 2 rokov pred | |
fetch-npm-node.js | 2 rokov pred | |
package.json | 2 rokov pred |
Fetch for node and Browserify. Built on top of GitHub's WHATWG Fetch polyfill.
fetch
as a global so that its API is consistent between client and server.npm install --save isomorphic-fetch es6-promise
bower install --save isomorphic-fetch es6-promise
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);
});
All open source code released by FT Labs is licenced under the MIT licence. Based on the fine work by jxck.