Skip to content

Instantly share code, notes, and snippets.

@dtan
Created June 25, 2011 15:46
Show Gist options
  • Save dtan/1046605 to your computer and use it in GitHub Desktop.
Save dtan/1046605 to your computer and use it in GitHub Desktop.
node tls e
var tls = require('tls')
, fs = require('fs')
, host = 'localhost'
, port = 4001
, options = {
pkey: fs.readFileSync('keys/ssl.key'),
cert: fs.readFileSync('keys/ssl.crt')
}
, handler = function (s) {
s.write('welcome to a secure connection!');
s.pipe(s);
};
tls.createServer(options, handler).listen(port, host);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment