1
0
Fork 0
mirror of https://api.glitch.com/git/yaswvc synced 2026-01-12 03:18:10 +00:00
yaswvc/server.js
Glitch (hello-express) b255207d21 🚀☂️ Checkpoint
./server.js:3115263/491
2020-05-25 18:11:22 +00:00

28 lines
855 B
JavaScript

// server.js
// where your node app starts
// 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();
// make all the files in 'public' available
// https://expressjs.com/en/starter/static-files.html
app.use(express.static("public"));
// https://expressjs.com/en/starter/basic-routing.html
app.get("/", (request, response) => {
response.sendFile(__dirname + "/views/index.html");
});
// 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);