-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
52 lines (43 loc) · 1.25 KB
/
Copy pathserver.js
File metadata and controls
52 lines (43 loc) · 1.25 KB
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
const express = require('express')
const app = express()
const path = require('path')
const port = process.env.PORT || 3000
app.set('view engine', 'ejs')
app.set('views', path.join(__dirname, '/views'))
app.use(express.static(path.join(__dirname, 'public')))
app.get('/', (req, res) => {
const stylesheet = 'home'
const script = 'home'
const name = 'Home'
res.render('home', { stylesheet, script, name })
})
app.get('/home', (req, res) => {
const stylesheet = 'home'
const script = 'home'
const name = 'Home'
res.render('home', { stylesheet, script, name })
})
app.get('/about', (req, res) => {
const stylesheet = 'about'
const script = 'about'
const name = 'About Us'
res.render('about', { stylesheet, script, name })
})
app.get('/services', (req, res) => {
const stylesheet = 'services'
const script = 'services'
const name = 'Services'
res.render('services', { stylesheet, script, name })
})
app.get('/contact', (req, res) => {
const stylesheet = 'contact'
const script = 'contact'
const name = 'Contact Us'
res.render('contact', { stylesheet, script, name })
})
app.get('*', (req, res) => {
res.render('errorpage')
})
app.listen(port, () => {
console.log("LISTENING ON PORT 3000")
})