-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (31 loc) · 1.04 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
/**
* Module dependencies.
*/
var config = require('config');
var express = require('express');
var ContentService = require('./lib/contentService');
var FileCleanerService = require('./lib/fileCleanerService');
process.on('uncaughtException', function (err) {
console.error("[uncaughtException]", err);
process.exit(1);
});
process.on('SIGTERM', function () {
process.exit(0);
});
process.on('SIGINT', function () {
process.exit(0);
});
// web service
var app = express();
app.configure(function(){
app.use(express.static(__dirname + '/public'))
app.use(app.router);
app.set('contentService', new ContentService(config.content).startService());
app.set('fileCleanerService', new FileCleanerService(config.cache.lifetime));
});
app.configure('development', function() {
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
require('./routes')(app, config.server.useCors);
app.listen(config.server.port, config.server.host);
console.log('Express server listening on ' + config.server.host + ':' + config.server.port);