]> git.cworth.org Git - empires-server/commitdiff
Add a new "identifier" field to the metadata for each game
authorCarl Worth <cworth@cworth.org>
Sun, 31 May 2020 23:46:50 +0000 (16:46 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 1 Jun 2020 00:09:57 +0000 (17:09 -0700)
And use this in the handling of the root path to select the
appropriate HTML template to render.

empires.js
tictactoe.js

index 8713c6cf2f3d903b40b7a2597e0339161f39514c..f11d9cdb396bf1007ff393f4f5c311b1c37534a2 100644 (file)
@@ -255,7 +255,7 @@ router.get('/', (request, response) => {
   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) => {
@@ -360,7 +360,8 @@ exports.name = engine_name;
 exports.Game = Empires;
 
 Empires.meta = {
-  name: "Empires"
+  name: "Empires",
+  identifier: "empires"
 };
 
 exports.meta = Empires.meta;
index 7b7df8d4ac912da483348cb78354330eb74f5cfa..5b5270d21c41a001e0df9c81ca5deda95ba4778b 100644 (file)
@@ -44,7 +44,7 @@ router.get('/', (request, response) => {
   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) => {
@@ -74,7 +74,8 @@ exports.name = engine_name;
 exports.Game = TicTacToe;
 
 TicTacToe.meta = {
-  name: "Tic Tac Toe"
+  name: "Tic Tac Toe",
+  identifier: "tictactoe"
 };
 
 exports.meta = TicTacToe.meta;