forked from fzaninotto/screenshot-as-a-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
30 lines (25 loc) · 890 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
/**
* Module dependencies.
*/
var config = require('config');
var express = require('express');
var RasterizerService = require('./lib/rasterizerService');
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.use(express.static(__dirname + '/public'));
app.set('rasterizerService', new RasterizerService(config.rasterizer).startService());
app.set('fileCleanerService', new FileCleanerService(config.cache.lifetime));
require('./routes')(app, config.server.useCors);
app.listen(config.server.port);
console.log('Express server listening on ' + config.server.host + ':' + config.server.port);