Skip to content

Instantly share code, notes, and snippets.

@maxp
Created November 22, 2018 04:35
Show Gist options
  • Save maxp/81360a800f309c2f8f8e05433f4ed420 to your computer and use it in GitHub Desktop.
Save maxp/81360a800f309c2f8f8e05433f4ed420 to your computer and use it in GitHub Desktop.
https listener and key generation example
/**
openssl req -newkey rsa:2048 -nodes -batch -utf8 -keyout keytemp.pem -x509 -days 365 -out cert.pem \
-subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=example.com"
openssl rsa -in keytemp.pem -out key.pem
*/
import app from './app';
import * as https from 'https';
import * as fs from 'fs';
const PORT = 3000;
const httpsOptions = {
key: fs.readFileSync('./key.pem'),
cert: fs.readFileSync('./cert.pem')
}
https.createServer(httpsOptions, app).listen(PORT, () => {
console.log('Express server listening on port ' + PORT);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment