From b255207d21adf2508a21ba3fe4f2c78ce2d92d4d Mon Sep 17 00:00:00 2001 From: "Glitch (hello-express)" Date: Mon, 25 May 2020 18:11:22 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=E2=98=82=EF=B8=8F=20Checkpoint=20.?= =?UTF-8?q?/server.js:3115263/491?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/server.js b/server.js index 1df7216..6a4a539 100644 --- a/server.js +++ b/server.js @@ -3,16 +3,10 @@ // we've started you off with Express (https://expressjs.com/) // but feel free to use whatever libraries or frameworks you'd like through `package.json`. +const { ExpressPeerServer } = require("peer"); const express = require("express"); const app = express(); -// our default array of dreams -const dreams = [ - "Find and count some sheep", - "Climb a really tall mountain", - "Wash the dishes" -]; - // make all the files in 'public' available // https://expressjs.com/en/starter/static-files.html app.use(express.static("public")); @@ -22,13 +16,13 @@ app.get("/", (request, response) => { response.sendFile(__dirname + "/views/index.html"); }); -// send the default array of dreams to the webpage -app.get("/dreams", (request, response) => { - // express helps us take JS objects and send them as JSON - response.json(dreams); -}); - // listen for requests :) const listener = app.listen(process.env.PORT, () => { console.log("Your app is listening on port " + listener.address().port); }); + +const peerServer = ExpressPeerServer(listener, { + path: '/myapp' +}); + +app.use('/peerjs', peerServer);