-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
35 lines (27 loc) · 849 Bytes
/
app.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
/**
* Main application file
*/
'use strict';
process.on('uncaughtException', function (err) {
console.error(err.stack);
});
// require('dotenv').load();
// Set default node environment to development
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var express = require('express');
var config = require('./config/environment');
var models = require("./models");
// if(config.seedDB) { require('./config/seed'); }
// Setup server
var app = express();
var server = require('http').createServer(app);
require('./config/express')(app);
require('./routes/index.route')(app);
// Start server
models.sequelize.sync().then(() => {
server.listen(config.port, config.ip, function () {
console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
});
})
// Expose app
exports = module.exports = app;