-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (31 loc) · 852 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
35
36
37
38
39
40
41
const express = require('express')
// const mongoose = require('mongoose')
const cors = require('cors')
const bodyParser = require('body-parser')
const logger = require('morgan')
const PORT = process.env.PORT || 3000
// const DBPORT = process.env.MONGODB_URI
let app = express()
// mongoose.connect(DBPORT)
// mongoose.Promise = global.Promise
// let db = mongoose.connection
// db.on('error', console.error.bind(console, 'MongoDB connection error:'))
app.use(logger('dev'))
app.use(cors())
app.use(
bodyParser.urlencoded({
extended: false
})
)
app.use(bodyParser.json())
app.use(express.static('public'))
app.use(express.static('build'))
app.set('view engine', 'pug')
app.set('views', './views')
app.use('/', require('./routes'))
app.listen(PORT, err => {
if (err) {
throw err
}
console.info('Listening on port ' + PORT + '...')
})