Controller

The remove controller method deletes the specified game from the database, when a DELETE request is received at '/api/games/:gameId' and it has been verified that the current user is the original maker of the given game.

mern-vrgame/server/controllers/game.controller.js:

const remove = (req, res) => {  let game = req.game  game.remove((err, deletedGame) => {    if(err) {      return res.status(400).json({        error: errorHandler.getErrorMessage(err)      })    }    res.json(deletedGame)  })}

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.