-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
29 lines (25 loc) · 1.18 KB
/
server.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
// webapp dependencies
var express = require('express'),
contentAnalysisApp = express(),
http = require('http').Server(contentAnalysisApp),
httpPort = process.env.PORT || 3034,
io = require('socket.io')(http);
// serves the static files
contentAnalysisApp.use(express.static('www'));
contentAnalysisApp.use(express.static('node_modules/socket-io-ng-service/libs'));
contentAnalysisApp.use(express.static('node_modules/ui-router-menu-service/libs'));
contentAnalysisApp.use(express.static('node_modules/angular'));
contentAnalysisApp.use(express.static('node_modules/angular-sanitize'));
contentAnalysisApp.use(express.static('node_modules/@uirouter/angularjs/release'));
// starts the web aplication server on the configured HTTP port
http.listen(httpPort, function() {
console.log('listening on *:' + httpPort + '\nctrl+c to stop the app');
});
// shuts the application down on low-level errors
function shutdown() {
console.log('web-content-analysis is shutting down...');
process.exit(1);
};
process.on('SIGINT', shutdown).on('SIGTERM', shutdown);
// handles a websocket connection
io.sockets.on('connection', require('./api/socket')(require('./scrapping/scrapping')));