autocert
v5.1.0
Published
Get a TLS options object to automagically certify your domains
Downloads
5
Readme
autocert
Get a TLS options object that will automagically certify your domains.
Why
Obligatory Let's Encrypt thingy.
How
Example
var http = require('http')
var https = require('https')
var autocert = require('./')
var challenges = {}
http.createServer((req, res) => {
var proof = challenges[req.url]
if (proof) {
res.end(proof)
} else {
res.statusCode = 404
res.end('not found')
}
}).listen(80)
https.createServer(autocert.tlsOpts({
email: '[email protected]',
challenges,
}), (req, res) => {
res.end('secure af')
}).listen(443)
License
MIT