May 2018
Intermediate to advanced
470 pages
13h 54m
English
The GET request to open the React 360 index.html page will be declared in game.routes.js, as follows.
mern-vrgame/server/routes/game.routes.js:
router.route('/game/play') .get(gameCtrl.playGame)
This will execute the playGame controller method to return the index.html page in response to the incoming request.
mern-vrgame/server/controllers/game.controller.js:
const playGame = (req, res) => { res.sendFile(process.cwd()+'/server/vr/index.html')}
The playGame controller method will send the index.html placed in the /server/vr/ folder to the requesting client.
In the browser, this will render the React 360 game code, which will fetch the game details from the database using the read API, and render the game world ...
Read now
Unlock full access