+for (let key in engines) {
+ const engine = engines[key];
+
+ /* Add routes that are common to all games. */
+ engine.router.get('/', (request, response) => {
+ const game = request.game;
+
+ if (! request.session.nickname)
+ response.render('choose-nickname.html', { game_name: game.meta.name });
+ else
+ response.render(`${game.meta.identifier}-game.html`);
+ });
+
+ /* And mount the whole router at the path for the game. */
+ app.use(`/${engine.Game.meta.identifier}/[a-zA-Z0-9]{4}/`, engine.router);
+}