Created
October 27, 2016 15:12
-
-
Save rjriel/5a1448384316e74b3adc4748d0c24ebc 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
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