Skip to content

Instantly share code, notes, and snippets.

@yamikuronue
Created October 16, 2015 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamikuronue/b6f7f622f6d2557c108d to your computer and use it in GitHub Desktop.
Save yamikuronue/b6f7f622f6d2557c108d to your computer and use it in GitHub Desktop.
getAllGames: (res) => {
//For this sprint, all users can see all games
return new Promise((resolve, reject) => {
dao.getAllGames().then((data) => {
for (let i = 0; i < data.length; i++) {
data[i].canonical = `/api/game/${data[i].id}`;
}
res.send(data);
resolve();
}).catch((err) => {
//TODO: logging errors
res.status(500).send({error: `Database error: ${err}`});
reject();
});
})
},
getAllGames: (res) => {
//For this sprint, all users can see all games
dao.getAllGames().then((data) => {
for (let i = 0; i < data.length; i++) {
data[i].canonical = `/api/game/${data[i].id}`;
}
res.send(data);
}).catch((err) => {
//TODO: logging errors
res.status(500).send({error: `Database error: ${err}`});
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment