mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 08:38:24 +01:00
add a 404 to games if it doesnt exist :3
This commit is contained in:
parent
d46e1dfb80
commit
8203cc8f81
1 changed files with 13 additions and 4 deletions
|
@ -210,11 +210,20 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/game-hub", function (req, res) {
|
app.get("/game-hub", function (req, res) {
|
||||||
renderTemplate(res, req, "gamehub.ejs", {
|
var gameslist = ["pong", "tic-tac-toe", "sudoku", "snake"];
|
||||||
game: req.query.game,
|
var requestedGame = req.query.game;
|
||||||
});
|
|
||||||
|
if (!requestedGame || !gameslist.includes(requestedGame)) {
|
||||||
|
return renderTemplate(res, req, "404.ejs");
|
||||||
|
}
|
||||||
|
|
||||||
|
renderTemplate(res, req, "gamehub.ejs", {
|
||||||
|
game: requestedGame,
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
app.get("/static/:id", (req, res) => {
|
app.get("/static/:id", (req, res) => {
|
||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue