April 2020
Intermediate to advanced
716 pages
18h 55m
English
An authenticated and authorized user will be able to delete any of the games they created on the application. To enable this feature, we will implement a delete game API in the backend. We will start by adding a DELETE route that allows an authorized maker to delete one of their own games, as shown in the following code:
mern-vrgame/server/routes/game.routes.js:
router.route('/api/games/:gameId') .delete(authCtrl.requireSignin, gameCtrl.isMaker, gameCtrl.remove)
The flow of the controller method execution on the server, after receiving the DELETE request at api/games/:gameId, will be similar to the edit game API, with the final call made to the remove controller method instead of update.
The remove controller method deletes ...
Read now
Unlock full access