// function fetchAlbums(){
// fetch('https://rallycoding.herokuapp.com/api/music_albums')
// .then(res => res.json())
// .then(json => console.log(json))
// }
// console.log(fetchAlbums());
// async function fetchAlbums() {
// const res = await fetch('https://rallycoding.herokuapp.com/api/music_albums');
// const json = await res.json();
// console.log(json);
// }
// fetchAlbums();
const fetchAlbums = async () => {
const res = await fetch('https://rallycoding.herokuapp.com/api/music_albums');
const json = await res.json();
console.log(json);
}
fetchAlbums();
Last active
April 29, 2020 15:30
-
-
Save mojaray2k/fec9be09364eddaa7e4e29b893cd0605 to your computer and use it in GitHub Desktop.
Using Async/Await
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment