-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
37 lines (29 loc) · 1006 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
31
32
33
34
35
36
37
var express = require('express');
var fs = require('fs');
var app = require('express')();
var http = require('http').createServer(app);
var io = require('socket.io')(http);
var EventHandler = require('./custom_modules/EventHandler.js');
var SocketHandler = require('./custom_modules/SocketEventHandler.js');
var ServerCollection = require('./custom_modules/ServerCollection.js');
var LobbyListenerCollection = require('./custom_modules/LobbyListenerCollection.js');
var Path = require('path');
var dist = 'dist';
var src = 'src';
var PORT = process.env.PORT || 3000;
app.servers = new ServerCollection();
app.lobbyListeners = new LobbyListenerCollection();
app.set('view engine', 'tmpl');
app.get('/', function (req, res) {
fs.readFile('./public/index.html', 'utf8', function (err, text) {
res.send(text);
});
});
app.use(express.static('public'));
SocketHandler({
io: io,
app: app,
eventEmitter: EventHandler()
});
http.listen(PORT);
console.log('Listening on ', PORT);