Created
June 25, 2011 15:46
-
-
Save dtan/1046605 to your computer and use it in GitHub Desktop.
node tls e
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 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