-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
37 lines (27 loc) · 804 Bytes
/
server.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
'use strict';
// Module dependencies.
var express = require('express'),
path = require('path'),
fs = require('fs');
var app = express();
// Connect to database
var db = require('./lib/db/postgres');
// Bootstrap models
var modelsPath = path.join(__dirname, 'lib/models');
fs.readdirSync(modelsPath).forEach(function (file) {
require(modelsPath + '/' + file);
});
// Populate empty DB with dummy data
require('./lib/db/dummydata');
// Express Configuration
require('./lib/config/express')(app);
// Controllers
// Routes
require('./lib/controllers/routes')(app);
// Start server
var port = process.env.PORT || 8124;
app.listen(port, function () {
console.log('Express server listening on port %d in %s mode', port, app.get('env'));
});
// Expose app
exports = module.exports = app;