-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (29 loc) · 958 Bytes
/
index.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
const express = require('express')
// const pug = require('pug')
const hbs = require('express-handlebars')
const PeopleController = require('./controllers/people')
const parser = require('body-parser')
const methodOverride = require('method-override')
const app = express()
app.set('port', process.env.PORT || 3001)
// app.set('view engine', 'pug')
app.set('view engine', 'hbs')
app.engine('.hbs', hbs({
extname: '.hbs',
partialsDir: 'views/',
layoutsDir: 'views/',
defaultLayout: 'layout'
}))
app.use('/assets', express.static('public'))
// app.get('/', (req, res) => {
// res.render('index')
// })
app.use(methodOverride('_method'))
app.use(parser.urlencoded({ extended: true }))
app.get('/', (req, res) => {
res.render('index')
})
app.use('/people', PeopleController)
app.listen(app.get('port'), () => {
console.log('It\'s aliiive! on PORT', app.get('port'))
})