index.js 685 B

123456789101112131415161718192021222324252627282930313233
  1. var express = require('express');
  2. var router = express.Router();
  3. /* PeerServer */
  4. var app = express();
  5. var ExpressPeerServer = require('peer').ExpressPeerServer;
  6. // app.get('/', function(req, res, next) { res.send('Hello world!'); });
  7. var server = require('http').createServer(app);
  8. var options = {
  9. debug: true
  10. }
  11. app.use('/node_modules/peerjs', ExpressPeerServer(server, options));
  12. server.listen(9000);
  13. /* GET home page. */
  14. router.get('/', function(req, res, next) {
  15. res.render('index');
  16. });
  17. router.get('/send', function(req, res, next) {
  18. res.render('send');
  19. });
  20. router.get('/receive', function(req, res, next) {
  21. res.render('receive');
  22. });
  23. module.exports = router;