-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
30 lines (23 loc) · 705 Bytes
/
server.js
File metadata and controls
30 lines (23 loc) · 705 Bytes
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
var express = require('express');
var engines = require('consolidate');
var http = require('http');
var io = require('socket.io');
var clientConnection = require('./clientConnection');
var port = process.env.PORT || 3000;
var app = express();
var server = http.createServer(app);
io = io.listen(server);
server.listen(port);
app.engine('html', engines.hogan);
app.set('view engine', 'html');
app.set('views', __dirname + '/views');
app.use(express.static('public'));
app.get('/', function(req, res) {
res.render('index');
});
app.get('/host', function (req, res) {
res.render('index', {host: true});
});
io.sockets.on('connection', function (socket) {
clientConnection.init(socket);
});