Archived
1
0
Fork 0

Add routes

This commit is contained in:
Ethanell 2020-05-29 12:55:56 +02:00
parent 1690e70cc1
commit d95a0e9918
13 changed files with 80 additions and 32 deletions

10
app.js
View file

@ -5,6 +5,11 @@ const cookieParser = require("cookie-parser");
const logger = require("morgan"); const logger = require("morgan");
const indexRouter = require("./routes/index"); const indexRouter = require("./routes/index");
const loginRouter = require("./routes/login")
const logoutRouter = require("./routes/logout")
const commandsRouter = require("./routes/commands")
const kitchenRouter = require("./routes/kitchen")
const stocksRouter = require("./routes/stocks")
const app = express(); const app = express();
@ -19,6 +24,11 @@ app.use(cookieParser());
app.use(express.static(path.join(__dirname, "public"))); app.use(express.static(path.join(__dirname, "public")));
app.use("/", indexRouter); app.use("/", indexRouter);
app.use("/login", loginRouter);
app.use("/logout", logoutRouter);
app.use("/commands", commandsRouter);
app.use("/kitchen", kitchenRouter);
app.use("/stocks", stocksRouter);
// catch 404 and forward to error handler // catch 404 and forward to error handler
app.use(function(req, res, next) { app.use(function(req, res, next) {

View file

@ -13,7 +13,7 @@
"morgan": "~1.9.1", "morgan": "~1.9.1",
"pg": "^8.2.1", "pg": "^8.2.1",
"pg-hstore": "^2.3.3", "pg-hstore": "^2.3.3",
"pug": "2.0.0-beta11", "pug": "^2.0.0-beta11",
"sequelize": "^5.21.11", "sequelize": "^5.21.11",
"sequelize-cli": "^5.5.1", "sequelize-cli": "^5.5.1",
"socket.io": "^2.3.0" "socket.io": "^2.3.0"

9
routes/commands.js Normal file
View file

@ -0,0 +1,9 @@
const express = require("express");
const router = express.Router();
/* GET home page. */
router.get("/", function(req, res) {
res.render("commands", { title: "Kfet - Commands" });
});
module.exports = router;

View file

@ -2,8 +2,8 @@ const express = require("express");
const router = express.Router(); const router = express.Router();
/* GET home page. */ /* GET home page. */
router.get("/", function(req, res, next) { router.get("/", function(req, res) {
res.render("index", { title: "Express" }); res.render("index", { title: "Kfet" });
}); });
module.exports = router; module.exports = router;

9
routes/kitchen.js Normal file
View file

@ -0,0 +1,9 @@
const express = require("express");
const router = express.Router();
/* GET home page. */
router.get("/", function(req, res) {
res.render("kitchen", { title: "Kfet - Kitchen" });
});
module.exports = router;

9
routes/login.js Normal file
View file

@ -0,0 +1,9 @@
const express = require("express");
const router = express.Router();
/* GET home page. */
router.get("/", function(req, res) {
res.render("login", { title: "Kfet - Login" });
});
module.exports = router;

9
routes/logout.js Normal file
View file

@ -0,0 +1,9 @@
const express = require("express");
const router = express.Router();
/* GET home page. */
router.get("/", function(req, res) {
res.send("Ok");
});
module.exports = router;

9
routes/stocks.js Normal file
View file

@ -0,0 +1,9 @@
const express = require("express");
const router = express.Router();
/* GET home page. */
router.get("/", function(req, res) {
res.render("stocks", { title: "Kfet - Stocks" });
});
module.exports = router;

View file

@ -25,7 +25,7 @@ block content
a(href="/logout") a(href="/logout")
button.contact2-form-btn Logout button.contact2-form-btn Logout
div.bg-contact2#main-container(style="background-image: /images/bg-01.jpg;") div#main-container.bg-contact2(style="background-image: url(/images/bg-01.jpg);height: 93vh")
form.container(action="#") form.container(action="#")
div#dish div#dish
h1 Dish h1 Dish

View file

@ -1,7 +1,7 @@
extends layout extends layout
block content block content
div#main-container.bg-contact2(style="background-image: /images/bgcuisine.png") div#main-container.bg-contact2(style="background-image: url(/images/bgcuisine.png)")
div#middle-container div#middle-container
div#WIP div#WIP
div#waiting div#waiting

View file

@ -1,31 +1,24 @@
extends layout extends layout
block content block content
div.bg-contact2(style="background-image: /images/bg-01.jpg") div.bg-contact2(style="background-image: url(/images/bg-01.jpg);")
div.container-contact2 div.container-contact2
div.wrap-contact2 div.wrap-contact2
span.contact2-form-title Login span.contact2-form-title Login
div.wrap-input2.validate-input(data-validate="Username is required")
p Kfet member: input.input2(type="text" name="name")
form(action="" method="post" novalidate) span.focus-input2(data-placeholder="Username")
div.wrap-input2.validate-input(data-validate="Username is required") div.wrap-input2.validate-input(data-validate="Password invalid")
input.input2(type="text" name="name") input.input2(type="password" name="password")
span.focus-input2(data-placeholder="Username") span.focus-input2(data-placeholder="Mot de passe")
div#fct
div.wrap-input2.validate-input(data-validate="Password required") input#commi(type="radio" name="fct")
input.input2(type="password" name="password") label(for="commi") Commi
span.focus-input2(data-placeholder="Password") input#pc(type="radio" name="fct")
label(for="pc") PC
div#fct input#guest(type="radio" name="fct")
input#commi(type="radio" name="dct") label(for="guest") Guest
label(for="commi") Commi div.container-contact2-form-btn
div.wrap-contact2-form-btn
input#pc(type="radio" name="fct") div.contact2-form-bgbtn
label(for="pc") PC button.contact2-form-btn(type="submit") Login
input#guest(type="radio" name fct)
label(for="guest") Guest
div.contact2-form-btn
div.wrap-contact2-form-btn
button.contact2-form-btn(type="submit") Login

View file

@ -6,7 +6,7 @@ block content
a#gobackpc(onclick="window.close()") a#gobackpc(onclick="window.close()")
li Back to commands li Back to commands
div#main-container.bg-contact2(style="background-image: /images/bg-01.jpg") div#main-container.bg-contact2(style="background-image: url(/images/bg-01.jpg)")
form#stocks.container(action="#") form#stocks.container(action="#")
div#teams div#teams
div#sandwich div#sandwich

View file

@ -1,7 +1,7 @@
extends layout extends layout
block content block content
div#main-container.bg-contact2(stype="background-image: /images/bg-01.jpg") div#main-container.bg-contact2(style="background-image: url(/images/bg-01.jpg);")
form#stocks.container(action="#") form#stocks.container(action="#")
div#dish div#dish
h1 Dishes h1 Dishes