I created a server that is set up with https below sample:
const express = require("express");
const fs = require("fs");
const https = require("https");
const app = express();
const port = process.env.PORT || 8000;
var options = {
key: fs.readFileSync("server.key"),
cert: fs.readFileSync("server.cert"),
};
app.listen(port);
https.createServer(options, app).listen(8080, function () {
console.log(
"Example app listening on port 8080! Go to https://localhost:8080/"
);
});
this works fine, but I am not sure how to configure React to make proper handshake. I want to secure both as I want to be able to send files from front to back end securely. I tried setting script in package.json to
"start": "set HTTPS=true&&set SSL_CRT_FILE=server.cert&&set SSL_KEY_FILE=server.key&&react-scripts start"
where I copied .cert and .key that I generated for backend. But as I understood I need to set up different ones locally. https://medium.com/@danielgwilson/https-and-create-react-app-3a30ed31c904 I probably misunderstood something about TLS/HTTPS