buenos-https
v0.3.1
Published
HTTPS server wrapper with self-signed certificates
Downloads
37
Maintainers
Readme
Buenos Https!
Wrap your application in https using embedded self-signed certificates. Not so much for security, but primarily for easily setting up (local) https servers during development.
Installing
$ npm install --save-dev buenos-https
Example
var $buenosHttps = require('buenos-https');
// construct an express app for demonstration purposes
var $express = require('express');
var app = $express();
app.use($express.static('.'));
// wrap app in https
$buenosHttps(app)
.listen(8000, function () {
console.log('Express app now listening on https://localhost:8000');
}
API
buenosHttps(app, [options])
Returns an https.Server (which is a subclass of tls.Server) instance.
var $buenosHttps = require('buenos-https');
$buenosHttps(app);
// or
$buenosHttps(app, options);
app
should be a requestListener
; something that can be stuffed into
https.createServer
.
options
is an optional https
options object. See documentation of
tls.createServer
.
By default the options object contains the result of buenosHttps.getDefaultOptions
, the very minimal to set up
a secure server.
buenosHttps.getDefaultOptions()
Returns the default options object, includes the embedded certificates.
var $buenosHttps = require('buenos-https');
$buenosHttps.getDefaultOptions();
// returns:
// {
// key: 'server key',
// cert: 'server cert'
// }