-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
executable file
·34 lines (26 loc) · 909 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
var debug = require('debug')('ProjectJS');
var express = require('express');
var serverSettings = express();
/** This is the heart of all project-related settings
* the global.Project is passed into bootstrap.js to
* avoid loading the Project setting object again.
* This happens when using gulp run
*/
debug('Calling bootstrap.js to set serverSettings');
var ProjectJS = require('./config/bootstrap.js'),
Project = ProjectJS(serverSettings),
logger = Project.logger;
/* Defining hooks when server is shutdown */
// listen for TERM signal .e.g. kill
debug('Defining hooks when server is shutdown');
process.on ('SIGTERM', function(){
ProjectJS.Projects.shutdown(process.exit);
});
// listen for INT signal e.g. Ctrl-C
process.on ('SIGINT', function(){
ProjectJS.Projects.shutdown(process.exit);
});
module.exports = {
serverSettings: serverSettings,
Project: Project
};