Skip to content

Instantly share code, notes, and snippets.

@ry
Created January 4, 2011 00:03
Show Gist options
  • Save ry/764213 to your computer and use it in GitHub Desktop.
Save ry/764213 to your computer and use it in GitHub Desktop.
new node https api
// curl -k https://localhost:8000/
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
@tj
Copy link

tj commented Jan 13, 2011

dude that is nasty lol wtf

@rikkert
Copy link

rikkert commented Jan 13, 2011

It is very sweet the way it is, just like we are used with require('http').
Great stuff tnx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment