-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhtmlRoutes.js
59 lines (49 loc) · 1.28 KB
/
htmlRoutes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var db = require("../models");
module.exports = function(app) {
// Load index page
app.get("/submit", function(req, res) {
db.Example.findAll({}).then(function(dbExamples) {
res.render("index", {
msg: "Welcome!",
examples: dbExamples
});
});
});
app.get("/", function(req, res) {
db.Example.findAll({}).then(function() {
res.render("login", {
});
});
});
app.get("/profile", function(req, res) {
db.Example.findOne({ where: { id: 1 } }).then(function(dbExample) {
res.render("profile", {
example: dbExample
});
});
});
app.get("/robot", function(req, res) {
db.Example.findAll({}).then(function() {
res.render("robot", {
});
});
});
app.get("/walletplus", function(req, res) {
db.Example.findAll({}).then(function() {
res.render("walletplus", {
});
});
});
// Load example page and pass in an example by id
app.get("/example/:id", function(req, res) {
db.Example.findOne({ where: { id: req.params.id } }).then(function(dbExample) {
res.render("example", {
example: dbExample
});
});
});
// Render 404 page for any unmatched routes
app.get("*", function(req, res) {
res.render("404");
});
};