May 2018
Intermediate to advanced
470 pages
13h 54m
English
The list controller method will query the Game collection in the database to return all the games in the response to the client.
mern-vrgame/server/controllers/game.controller.js:
const list = (req, res) => { Game.find({}).populate('maker', '_id name') .sort('-created').exec((err, games) => { if(err) { return res.status(400).json({ error: errorHandler.getErrorMessage(err) }) } res.json(games) })}
Read now
Unlock full access