Link database on index page generation for sandwichs & sandwichs
This commit is contained in:
parent
519e020831
commit
9c0c14a34b
2 changed files with 12 additions and 12 deletions
|
@ -1,9 +1,11 @@
|
|||
let express = require("express");
|
||||
let router = express.Router();
|
||||
let models = require("../models");
|
||||
|
||||
/* GET home page. */
|
||||
router.get("/", (req, res) => {
|
||||
res.render("index", { title: "SOD" });
|
||||
router.get("/", async (req, res) => {
|
||||
let departments = await models.Department.findAll();
|
||||
let sandwichs = await models.Sandwich.findAll();
|
||||
res.render("index", { title: "SOD", departments: departments, sandwichs: sandwichs });
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
@ -6,14 +6,11 @@ block content
|
|||
p Welcome to Sandwiches Order Doua
|
||||
form#command(action="/command" method="POST")
|
||||
div.field
|
||||
label(for="department") Department:
|
||||
label(for="sandwich") Department:
|
||||
input#department(type="list" list="department-list" name="department" required)
|
||||
datalist#department-list
|
||||
option(value="Info")
|
||||
option(value="Bio")
|
||||
option(value="Chimi")
|
||||
option(value="GC")
|
||||
option(value="GEA")
|
||||
each department in departments
|
||||
option(value=department.name)
|
||||
|
||||
div.field
|
||||
label(for="firstname") First name:
|
||||
|
@ -39,13 +36,14 @@ block content
|
|||
input#send(type="submit" value="Pay")
|
||||
|
||||
datalist#sandwich-list
|
||||
option(value="Jambon beurre")
|
||||
each sandwich in sandwichs
|
||||
option(value=sandwich.name)
|
||||
datalist#date-list
|
||||
option(value="14/08/2020")
|
||||
|
||||
div#more
|
||||
a(href="#about") About
|
||||
a(href="#contact") Contact
|
||||
a About
|
||||
a Contact
|
||||
|
||||
div#dark.hide
|
||||
div#about.card.hide
|
||||
|
|
Reference in a new issue