PairDrop/index.js
2015-12-26 13:33:16 +01:00

22 lines
595 B
JavaScript

'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
}));
console.log('listening on port ' + port);