Created
April 8, 2016 20:48
-
-
Save alvarow/0377eb3ffec534428135eec1ea80ba9f to your computer and use it in GitHub Desktop.
node.js https server example
This file contains 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
// curl -k https://localhost:8000/ | |
const https = require('https'); | |
const fs = require('fs'); | |
const options = { | |
passphrase: '1234', | |
dhparam: fs.readFileSync('dhparam.pem'), | |
key: fs.readFileSync('cert.key'), | |
cert: fs.readFileSync('cert.pem'), | |
ca: fs.readFileSync('ca.pem') | |
}; | |
https.createServer(options, (req, res) => { | |
res.writeHead(200); | |
res.end('hello world\n'); | |
}).listen(8443); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment