-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
24 lines (17 loc) · 630 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
'use strict'
const express = require('express');
const bodyParser = require('body-parser');
const env = process.env.NODE_ENV || 'development';
const app = express();
const config = require('./server/config/config')[env];
app.use(bodyParser.urlencoded({extended: false}))
app.use(bodyParser.json())
app.use(express.static('public'))
// Setup db and open connection
require('./server/config/mongoose')(config);
// Configure generic routes
require('./server/config/routes')(app, config);
// Configure api routes
require('./server/config/api')(app);
app.listen(config.port);
console.log(`Listening on port ${config.port}...`);