Created
November 8, 2015 11:55
-
-
Save kevinzhang96/272eaf8ca3e9e57c080e to your computer and use it in GitHub Desktop.
Node.js app file for YHack15, party-mode app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); var app = express(); | |
+var http = require('http').Server(app); | |
+var io = require('socket.io')(http); | |
app.use(express.static(__dirname + '/public')); app.use(express.static(__dirname + '/public')); | |
app.listen(process.env.PORT || 3000); app.listen(process.env.PORT || 3000); | |
+http.listen(3001, function(){ | |
+ console.log('listening on *:3001'); | |
+}); | |
+io.on('connection', function(socket){ | |
+ socket.on('kinect', function(msg){ | |
+ io.emit('kinect', msg); | |
+ console.log(msg); | |
+ }); | |
+}); | |
+ | |
+ | |
app.use('/public', express.static(__dirname + '/public')); app.use('/public', express.static(__dirname + '/public')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment