Closed eurobob closed 7 years ago
So i figured it out, I had to create a certificate first. Hopefully this will help others.
Ended up down this path due to service workers requiring a https connection and I wanted to test. Would still be interested in knowing if there was a simpler way that I overlooked :)
const cert = fs.readFileSync('cert.pem');
const options = {
key: key,
cert: cert,
passphrase: 'XXXXXXXX', // optional if you protected the cert with a passphrase
};
const https = require('https').createServer(options, app);
// Create an http listener for our express app.
const listener = https.listen(config.port, config.host, () =>
console.log(`Server listening on port ${config.port}`),
);
I've been trying to create a https listener instead of http, but I can't make it work :/