Skip to content

Commit

Permalink
add commented lines to enable https
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin committed Apr 3, 2024
1 parent 56d6011 commit a4479b6
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
// Load required modules
const http = require("http"); // http server core module
const http = require("http"); // http server core module
const path = require("path");
const express = require("express"); // web framework external module
const socketIo = require("socket.io"); // web socket external module
const easyrtc = require("open-easyrtc"); // EasyRTC external module
const express = require("express"); // web framework external module
const socketIo = require("socket.io"); // web socket external module
const easyrtc = require("open-easyrtc"); // EasyRTC external module
// To generate a certificate for local development with https, you can run
// `npm run dev2`, it will create the node_modules/.cache/webpack-dev-server/server.pem file.
// Then stop it, change the lines here and run `npm start`.
// To enable https on the node server, uncomment the next lines
// and the webServer line down below.
// const https = require("https");
// const fs = require("fs");
// const privateKey = fs.readFileSync("node_modules/.cache/webpack-dev-server/server.pem", "utf8");
// const certificate = fs.readFileSync("node_modules/.cache/webpack-dev-server/server.pem", "utf8");
// const credentials = { key: privateKey, cert: certificate };

// Set process name
process.title = "networked-aframe-server";
Expand Down Expand Up @@ -32,6 +42,8 @@ app.use(express.static("public"));

// Start Express http server
const webServer = http.createServer(app);
// To enable https on the node server, comment the line above and uncomment the line below
// const webServer = https.createServer(credentials, app);

// Start Socket.io so it attaches itself to Express server
const socketServer = socketIo.listen(webServer, { "log level": 1 });
Expand Down

0 comments on commit a4479b6

Please sign in to comment.