Created
November 22, 2018 04:35
-
-
Save maxp/81360a800f309c2f8f8e05433f4ed420 to your computer and use it in GitHub Desktop.
https listener and key generation example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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