-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (19 loc) · 738 Bytes
/
index.js
File metadata and controls
26 lines (19 loc) · 738 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
const express = require('express')
const path = require('path')
const app = express()
const bodyParser = require('body-parser')
require('dotenv/config')
const model = require('./models/index')
const pessoas = require('./routes/pessoas')
app.use(bodyParser.urlencoded({ extended: true }))
app.use(express.static('public'))
app.get('/', (req, res) => res.render('index'))
app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'ejs')
app.use('/pessoas', pessoas)
const forceReBuiilDB = false;
model.sequelize.sync({ force: forceReBuiilDB }).then(() => {
const port = process.env.PORT || 3000
const webLink = 'http://localhost'
app.listen(port, () => console.log(`\nApp is run in ${webLink}:${port}\n`))
})