-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
57 lines (45 loc) · 1.26 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
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
var express = require('express'),
config = require('./config'),
http = require('http'),
db = require('./model/db'),
passport = require('passport');
/**
* Process level exception catcher
*/
process.on('uncaughtException', function (err) {
console.log("Node NOT Exiting...");
console.log(err);
console.log(err.stack);
});
var app = express();
db.connectDb(function(db){
/**
* Passport.js intiallization
*/
require('./configrations/passport-config')(passport);
/**
* Express Configuration
*/
require('./configrations/express-config')(db,app,passport);
/**
* Start http server here
*/
var server = http.createServer(app);
server.listen(config.main.port);
console.log("Listening on " + config.main.port);
})
/**
* Setting socket.io
*/
//var io = require('socket.io').listen(server);
//io.configure(function () {
// io.set("transports", ["xhr-polling"]);
// io.set("polling duration", 10);
//});
//io.sockets.on('connection', function (socket) {
// socket.emit('news', database.news[util.getRandomInt(0,4)]);
//});
//
//setInterval(function(){
// io.sockets.emit('news', database.news[util.getRandomInt(0,4)] )
//},10000);