Skip to content

Instantly share code, notes, and snippets.

@laere
Created February 6, 2016 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laere/7ef379fb0c363cc34c4f to your computer and use it in GitHub Desktop.
Save laere/7ef379fb0c363cc34c4f to your computer and use it in GitHub Desktop.
var Fetch = require('whatwg-fetch');
var baseURL = 'http://swapi.co/api';
var service = {
get: function(url) {
return fetch(baseURL + url)
//returning a promise
//function callback that will promise us something
.then(function(response) {
return response.json();
});
}
};
module.exports = service;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment