Created
May 4, 2016 13:28
-
-
Save AndyNovo/41256f58cd5545c6a3575853ff767730 to your computer and use it in GitHub Desktop.
local server with certificates
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
var https = require("https"); | |
var fs = require("fs"); | |
var options = { | |
key: fs.readFileSync('cert.key'), | |
cert: fs.readFileSync('cert.crt'), | |
requestCert: false, | |
rejectUnauthorized: false | |
}; | |
// create a server | |
https.createServer(options, function(req, res) { | |
console.log("This works!"); | |
res.writeHead(200); | |
res.end("Hello there!"); | |
}).listen(12345, 'localhost'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment