2015-12-26 12:33:16 +00:00
|
|
|
'use strict';
|
|
|
|
var express = require('express');
|
|
|
|
var compression = require('compression');
|
|
|
|
var app = express();
|
|
|
|
var http = require('http');
|
|
|
|
var ExpressPeerServer = require('peer').ExpressPeerServer;
|
|
|
|
var wsServer = require('./server/ws-server.js');
|
|
|
|
|
|
|
|
var server = http.createServer(app);
|
|
|
|
|
|
|
|
// Serve up content from public directory
|
|
|
|
app.use(compression());
|
|
|
|
app.use(express.static(__dirname + '/public'));
|
|
|
|
|
|
|
|
var port = process.env.PORT || 3002;
|
|
|
|
server.listen(port);
|
|
|
|
wsServer.create(server);
|
|
|
|
app.use('/peerjs', ExpressPeerServer(server, {
|
|
|
|
debug: true
|
|
|
|
}));
|
|
|
|
|
2015-12-30 15:50:21 +00:00
|
|
|
|
2015-12-26 12:33:16 +00:00
|
|
|
console.log('listening on port ' + port);
|