From 62240e8370e6bc656a17eaef595275a92020a617 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 24 Oct 2022 23:39:27 +0200 Subject: Added favicon, split view in multiple parts --- main.js | 30 +++-------------- routes/play.js | 29 ++++++++++++++++ static/favicon.svg | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ views/footer.ejs | 3 ++ views/header.ejs | 13 ++++++++ views/index.ejs | 47 -------------------------- views/play.ejs | 36 ++++++++++++++++++++ 7 files changed, 182 insertions(+), 73 deletions(-) create mode 100644 routes/play.js create mode 100644 static/favicon.svg create mode 100644 views/footer.ejs create mode 100644 views/header.ejs delete mode 100644 views/index.ejs create mode 100644 views/play.ejs diff --git a/main.js b/main.js index b4b626b..2765c83 100644 --- a/main.js +++ b/main.js @@ -1,36 +1,14 @@ import express from "express"; -export const app = express(); +import playRouter from "./routes/play.js"; + +const app = express(); app.set("views", "./views"); app.set("view engine", "ejs"); -let CWDATA = { - board: [ - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "T", "E", "S","T", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], - [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ] - ], - letters: [ "A", "B", "C", "D", "E", "F", "JOKER" ] -}; - -app.get("/", (req, res) => { - return res.render("index", {CWDATA: CWDATA}); -}); - app.use(express.static("static")); +app.use("/play", playRouter); const port = process.env.PORT || 3000; app.listen(port, () => console.log(`listening on port ${port}`)); diff --git a/routes/play.js b/routes/play.js new file mode 100644 index 0000000..5e904c4 --- /dev/null +++ b/routes/play.js @@ -0,0 +1,29 @@ +import express from "express"; + +const router = express.Router(); + +router.get("/", (req, res) => { + const CWDATA = { + board: [ + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "T", "E", "S","T", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ], + [ "", "", "", "", "","", "", "", "", "","", "", "", "", "" ] + ], + letters: [ "A", "B", "C", "D", "E", "F", "JOKER" ] + }; + return res.render("play", {CWDATA: CWDATA, title: "Jouer"}); +}); + +export default router; diff --git a/static/favicon.svg b/static/favicon.svg new file mode 100644 index 0000000..971d573 --- /dev/null +++ b/static/favicon.svg @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + A + 1 + + diff --git a/views/footer.ejs b/views/footer.ejs new file mode 100644 index 0000000..a78654e --- /dev/null +++ b/views/footer.ejs @@ -0,0 +1,3 @@ + + + diff --git a/views/header.ejs b/views/header.ejs new file mode 100644 index 0000000..ddc0b56 --- /dev/null +++ b/views/header.ejs @@ -0,0 +1,13 @@ + + + + + + + + + Jeu de mots - <%- title %> + + + +
diff --git a/views/index.ejs b/views/index.ejs deleted file mode 100644 index 4e691f7..0000000 --- a/views/index.ejs +++ /dev/null @@ -1,47 +0,0 @@ - - - - Jeu de mots - - - - - -
-

Jeu de mots

- - - - - - - - - - - - - - - - -
-

- - -
-

-

-

- player one name: 0
- player two name: 0 -

-

-
- - - - diff --git a/views/play.ejs b/views/play.ejs new file mode 100644 index 0000000..5998e40 --- /dev/null +++ b/views/play.ejs @@ -0,0 +1,36 @@ +<%- include("header") %> +

Jeu de mots

+ + + + + + + + + + + + + + + + +
+

+ + +
+

+

+

+player one name: 0
+player two name: 0 +

+

+ + +<%- include("footer") %> -- cgit v1.2.3