Created
February 5, 2016 14:54
-
-
Save laere/9765a0fb8fb7d36c6e01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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