X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lmno.js;h=65c317d05f37bb1b964781dd84b1b6d0f3b0f1ab;hb=e26d357ee7d6e689d098889de66d1c8c40482544;hp=fbef78f208a7decfd46300b094c29ce554b22515;hpb=cb2a7a1bb519b307a671dbe9310dbf95665ff63d;p=empires-server diff --git a/lmno.js b/lmno.js index fbef78f..65c317d 100644 --- a/lmno.js +++ b/lmno.js @@ -133,11 +133,15 @@ app.use('/empires/:game_id([a-zA-Z0-9]{4})', (request, response, next) => { return; } - request.game = lmno.ids[game_id].game; - if (request.game === undefined) { + /* See if there is any game with this ID. */ + const game = lmno.ids[game_id]; + if (game === undefined) { response.sendStatus(404); return; } + + /* Stash the game onto the request to be used by the game-specific code. */ + request.game = game.game; next(); });