Skip to content

KrekkieD/buenos-https

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'
// }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published