-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (20 loc) · 700 Bytes
/
index.js
File metadata and controls
26 lines (20 loc) · 700 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 cors = require('cors')
const bodyParser = require('body-parser')
const morgan = require('morgan')
const config = require('./config')
const routes = require('./server/routes')
// connect to the database and load models
require('./server/models').connect(config.mongoUri)
const app = express()
app.use(morgan('combined'))
app.use(cors())
// tell the app to parse HTTP body messages
app.use(bodyParser.json())
routes(app)
app.set('port', (process.env.PORT || 9003))
app.set('ip', (process.env.IP || '127.0.0.1'))
// start the server
app.listen(app.get('port'), app.get('ip'), () => {
console.log(`Assets Server is running on port ${app.get('port')}`)
})