Skip to content

Instantly share code, notes, and snippets.

@ysmood
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ysmood/8f330ccffc99f18c1c74 to your computer and use it in GitHub Desktop.
Save ysmood/8f330ccffc99f18c1c74 to your computer and use it in GitHub Desktop.
https example
###
openssl genrsa -out key.pem
openssl req -new -key key.pem -out csr.pem
openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
rm csr.pem
###
{ kit } = require 'nobone'
https = require 'https'
port = 8123
opts =
key: kit.readFileSync 'key.pem'
cert: kit.readFileSync 'cert.pem'
https.createServer opts, (req, res) ->
res.end 'ok'
.listen port, ->
kit.log 'Listen: ' + port
kit.request {
url: "https://127.0.1:#{port}"
rejectUnauthorized: false
}
.then (body) ->
kit.log body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment