Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
HTTPS Test Server
#!/usr/bin/env node
const fs = require("fs"),
https = require("https");
var opts = {
key: fs.readFileSync("myprivatekey.pem", 'utf8'),
cert: fs.readFileSync("mypublickey.pem", 'utf8'),
ca: [fs.readFileSync("ca-pub.pem", 'utf8')],
requestCert: true,
rejectUnauthorized: true
var handler = function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
var server = https.createServer(opts, handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment