Created
October 16, 2015 16:55
-
-
Save yamikuronue/b6f7f622f6d2557c108d 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
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(); | |
}); | |
}) | |
}, |
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
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