-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
34 lines (27 loc) · 689 Bytes
/
Copy pathapp.js
File metadata and controls
34 lines (27 loc) · 689 Bytes
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
const express = require('express')
const app = express()
const port = 3000
const exphbs = require('express-handlebars')
//setting template engine
app.engine('handlebars' ,exphbs({defaultLayout:'main'}))
app.set('view engine', 'handlebars')
//use static router
app.use(express.static('public'))
//router index setting
app.get('/', (req, res) => {
res.render('index')
})
//setting router
app.get('/about',(req, res) => {
res.render('about')
})
app.get('/portfolio',(req, res) => {
res.render('portfolio')
})
app.get('/contact',(req, res) => {
res.render('contact')
})
//listen router
app.listen(port, () => {
console.log(`Express is running on http://localhost:${port}`)
})