Last active
October 16, 2015 18:13
-
-
Save yamikuronue/9f24f09f82ceec882227 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
getGame: (req, res) => { | |
if (!req.params.id) { | |
res.status(501).send({error: 'Missing ID'}); | |
return; | |
} | |
return dao.getGame(req.params.id).then((data) => { | |
if (Array.isArray(data)) { | |
data = data[0]; //Only the first game | |
} | |
if (!data) { | |
res.status(404); | |
return; | |
} | |
data.canonical = `/api/game/${data.id}`; | |
res.send(data); | |
}).catch((err) => { | |
//TODO: logging errors | |
res.status(500).send({error: `Database error: ${err}`}); | |
/*What do I put here to make "we passed, yay" appear on the console? */ | |
}); | |
} | |
getGame(res, req).then(console.log("we passed yay")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment