Created
April 24, 2018 23:25
-
-
Save jjsub/ebb4ff02bcd8b823b8fb17c041ae058e 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
// regular Promise() | |
function fetchAlbums() { | |
fetch('https://http://rallycoding.herokuapp.com/api/music_albums') | |
.then(res => res.json()) | |
.then(json => console.log(json)); | |
} | |
//async | |
async function fetchAlbums() { | |
const res = await fetch('http://rallycoding.herokuapp.com/api/music_albums'); | |
const json = await res.json(); | |
console.log(json); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment