Skip to content

Instantly share code, notes, and snippets.

@rjriel
Created October 27, 2016 15:12
Show Gist options
  • Save rjriel/5a1448384316e74b3adc4748d0c24ebc to your computer and use it in GitHub Desktop.
Save rjriel/5a1448384316e74b3adc4748d0c24ebc to your computer and use it in GitHub Desktop.
let getGame = (gameId) => {
return new Promise((resolve, reject) => {
// we want to perform a GET request to the games/:id API
// to retrieve information about the given game
let options = createOptions(`games/${gameId}`, "GET")
request.get(options, (error, res, body) => {
if (error || res.statusCode !== 200) {
console.error("Error Getting Game", error || res.body)
reject(error)
} else {
resolve(JSON.parse(body))
}
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment