Skip to content

Instantly share code, notes, and snippets.

@chrispouliot
Last active November 12, 2016 18:30
Show Gist options
  • Select an option

  • Save chrispouliot/0a379eec8beaee978fa1ed9724bbe3d7 to your computer and use it in GitHub Desktop.

Select an option

Save chrispouliot/0a379eec8beaee978fa1ed9724bbe3d7 to your computer and use it in GitHub Desktop.
async function loadPosts() {
try {
//Blocking
let postData = await request("https://jsonplaceholder.typicode.com/posts")
let posts = JSON.parse(postData)
let firstPost = posts[0]
//Blocking
let userPosts = await request(`https://jsonplaceholder.typicode.com/posts?userId=${firstPost.userId}`))
doSomething(userPosts)
} catch(err) {
console.log(`You done goofed ${err}`)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment