forked from compscipsu/rethinkChat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
57 lines (33 loc) · 1.03 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';
const Glue = require('glue');
var path = require('path');
var fs = require('fs');
var nconf = require('nconf');
require(path.join(__dirname, 'server/config/nconf')).init(nconf, path.join(__dirname, 'properties.json'));
// allow more event listeners, set to 0 to leave unrestriced
process.setMaxListeners(nconf.get('max-listeners') || 0);
process.maxTickDepth = nconf.get('max-tick-depth') || 400;
process.on('uncaughtException', function (err) {
console.log('Uncaught exception: ', JSON.stringify(err.stack));
throw err;
});
process.on('SIGTERM', function(){
server.close();
});
process.on('exit', function(){
server.close();
});
console.log('booting application on ' + process.pid.toString());
const options = {
relativeTo: __dirname
};
Glue.compose(require('./manifest.js'), options, function(err, server){
//configure static files
if(err) {
throw err;
}
require('./server/config/routes').init(server);
server.start(function() {
console.log('Server running at:', server.info.uri);
});
});