-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
48 lines (29 loc) · 959 Bytes
/
index.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
// var express, app, http, io;
(function() {
'use strict';
var User = require('./src/Main');
// here is all require
var express, app, http, io;
/*setup express*/
function setupExpress() {
express = require('express');
app = express();
http = require('http').Server(app);
io = require('socket.io')(http);
io.set('transports', ['websocket']);
/*is that necessary ?*/
app.use(express.static('public'));
http.listen(process.env.PORT || 3000, function() {
console.log('listening on *:3000');
});
/*this init all On Function of our incoming socket */
io.on('connection', function (socket) {
console.log('new connection');
new User(socket,io);
})
// test ??
}
setupExpress();
// var mongo=require('./mongo/test')
// Use connect method to connect to the server
}());