-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
59 lines (49 loc) · 1.51 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
52
53
54
55
56
57
58
59
var log = require('czagenda-log').from(__filename);
var lastSeen = require('./libs/lastSeen');
// ##################################################################################
// HTTP SERVER INITIALISATION
// ##################################################################################
var server = require('./libs/server.js');
var init_server = function() {
server.get('/', function(req, res) {
res.end('It works !');
});
require('./libs/rest').setup(server);
}
//init_server();
module.exports = server;
// ##################################################################################
// VALIDATOR INITIALISATION
// ##################################################################################
var validator = require('./libs/schemas/validator');
validator.approvedEnvironment.load( function(err, success) {
if(err !== null) {
log.critical('ValidatorEnvironment failed to load', err);
throw err;
} else {
log.notice('ValidatorEnvironment loaded');
init_server();
lastSeen.start();
}
})
/*
var io = require('socket.io').listen(server);
var sockets = [];
io.sockets.on('connection', function (socket) {
sockets.push(socket);
socket.on('disconnect', function () {
delete sockets[sockets.indexOf(socket)]
});
});
var sys = require("sys");
var writeStats = require('./libs/stats.js').writeStats;
setInterval( function () {
for (var i = 0, l = sockets.length;i<l;i++) {
try {
sockets[i].volatile.emit('stats', {write : writeStats.read()});
} catch (e) {
//
}
}
} ,100)
*/