Example of using Express & Node.js with HTTPS.
Install dependencies :
npm installThen launch the app.js file with node :
node app.jsYou can then access the server on the address : https://127.0.0.1:8443/
The certificate files are stored inside the ssl/ folder. You can generate new files with the following commands.
Create the private key :
openssl genrsa -out key.pem 1024Create the "Certificate Signing Request" :
openssl req -new -key key.pem -out csr.pemCreate the self-signed certificate :
openssl x509 -req -in csr.pem -signkey key.pem -out cert.pemAlternatively you can send the CSR to a Certificate Authority for signing.