And use this in the handling of the root path to select the
appropriate HTML template to render.
if (! request.session.nickname)
response.render('choose-nickname.html', { game_name: game.meta.name });
else
- response.render('empires-game.html');
+ response.render(`${game.meta.identifier}-game.html`);
});
router.post('/spectator', (request, response) => {
exports.Game = Empires;
Empires.meta = {
- name: "Empires"
+ name: "Empires",
+ identifier: "empires"
};
exports.meta = Empires.meta;
if (! request.session.nickname)
response.render('choose-nickname.html', { game_name: game.meta.name });
else
- response.render('tictactoe-game.html');
+ response.render(`${game.meta.identifier}-game.html`);
});
router.post('/move', (request, response) => {
exports.Game = TicTacToe;
TicTacToe.meta = {
- name: "Tic Tac Toe"
+ name: "Tic Tac Toe",
+ identifier: "tictactoe"
};
exports.meta = TicTacToe.meta;