Last active
October 31, 2019 22:13
-
-
Save macloo/8b2bc58ffd4c792a974d4b78461f098d to your computer and use it in GitHub Desktop.
Short and sweet example of using fetch and an API
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
// from https://frontendmasters.github.io/bootcamp/ajax - more info there | |
const BREEDS_URL = "https://dog.ceo/api/breeds/image/random"; | |
const promise = fetch(BREEDS_URL); | |
promise | |
.then(function(response) { | |
const processingPromise = response.json(); | |
return processingPromise; | |
}) | |
.then(function(processedResponse) { | |
console.log(breeds); | |
}); | |
console.log("this will log first"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment