-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
37 lines (25 loc) · 775 Bytes
/
server.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
'use strict'
const express = require('express');
const app = express();
app.use(express.static(__dirname))
app.set('view engine', 'pug');
let bakeryGoods = [
{"name": "cinnamon roll", "price": 3.95},
{"name": "french bread", "price": 7.95},
{"name": "blueberry muffin", "price": 1.95},
{"name": "dinner rolls (dozen)", "price": 10.95},
{"name": "herbed scone", "price": 2.95}
];
app.get('/', (req, res, next)=>{
res.render('index', {thisPage: "home"})
})
app.get('/inventory', (req, res, next)=>{
res.render('inventory', {bakeryGoods, thisPage: "inventory"})
})
app.get('/about', (req, res, next)=>{
res.render('about', {thisPage: "about"})
})
const port = process.env.PORT || 3000
app.listen(port, ()=>{
console.log(`listening on ${port}`)
});