check if param exists

This commit is contained in:
ashley 2024-05-31 11:42:39 +00:00
parent ccd7f8e14b
commit 0fc44971a1

View file

@ -214,7 +214,7 @@ app.get("/game-hub", function (req, res) {
var gameslist = ["pong", "tic-tac-toe", "sudoku", "snake"]; var gameslist = ["pong", "tic-tac-toe", "sudoku", "snake"];
var requestedGame = req.query.game; var requestedGame = req.query.game;
if (!gameslist.includes(requestedGame)) { if (req.query.game && !gameslist.includes(requestedGame)) {
return renderTemplate(res, req, "404.ejs"); return renderTemplate(res, req, "404.ejs");
} }