add a 404 to games if it doesnt exist :3

This commit is contained in:
ashley 2024-05-31 11:40:18 +00:00
parent d46e1dfb80
commit 8203cc8f81

View file

@ -211,10 +211,19 @@ module.exports = function (app, config, renderTemplate) {
});
app.get("/game-hub", function (req, res) {
var gameslist = ["pong", "tic-tac-toe", "sudoku", "snake"];
var requestedGame = req.query.game;
if (!requestedGame || !gameslist.includes(requestedGame)) {
return renderTemplate(res, req, "404.ejs");
}
renderTemplate(res, req, "gamehub.ejs", {
game: req.query.game,
game: requestedGame,
});
});
app.get("/static/:id", (req, res) => {
const id = req.params.id;