-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.js
30 lines (26 loc) · 820 Bytes
/
web.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
var async = require('async');
var express = require('express');
var util = require('util');
// create an express webserver
var app = express.createServer(
express.logger(),
express.static(__dirname + '/public'),
express.bodyParser(),
express.cookieParser(),
// set this to a secret value to encrypt session cookies
express.session({ secret: process.env.SESSION_SECRET || 'secret123' })
);
var io = require('socket.io').listen(app);
// listen to the PORT given to us in the environment
var port = process.env.PORT || 3000;
app.listen(port, function() {
console.log("Listening on " + port);
});
io.sockets.on('connection', function (socket) {
socket.on('flip', function (data) {
console.log("flip", data);
});
socket.on('match', function (data) {
console.log("match", data);
});
});