forked from jagonteam/complete-me
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
41 lines (29 loc) · 953 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
38
39
40
41
// App entry point
// ===============
'use strict';
var express = require('express'),
http = require('http'),
path = require('path'),
bodyParser = require('body-parser'),
fs = require('fs'),
methodOverride = require('method-override');
var logger = require("./utils/logger");
// transpiled dependencies
var game = require("./build/game");
// Configuration
// -------------
var publicPath = path.join(__dirname) + '/assets/';
// Launch server
// -------------
var app = express();
var server = http.createServer(app);
var io = require('socket.io')(server);
app.set('port', process.env.OPENSHIFT_NODEJS_PORT || 8080);
app.use(methodOverride());
app.use(express.static(publicPath));
server.listen(app.get('port'), process.env.OPENSHIFT_NODEJS_IP || server.INADDR_ANY, function() {
logger.info('Express server listening on port ' + app.get('port'));
});
// Start the game !
// ----------------
new game.Game(io.sockets);