Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Created May 4, 2016 13:28
Show Gist options
  • Save AndyNovo/41256f58cd5545c6a3575853ff767730 to your computer and use it in GitHub Desktop.
Save AndyNovo/41256f58cd5545c6a3575853ff767730 to your computer and use it in GitHub Desktop.
local server with certificates
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