0.4.0 • Published 9 years ago

simple-secure-server v0.4.0

Weekly downloads
5
License
ISC
Repository
github
Last release
9 years ago

Simple Secure Server

A simple module to instantiate a secure ExpressJS server based on environment.

Installation

npm i simple-secure-server

Default Example

The following will launch an ExpressJS server, without SSL.

require('simple-secure-server')(app);

Secure Example

The following will launch both the default server as well as one with SSL.

require('simple-secure-server')(app, {
    secure: true
});

##More Examples You can also supply a callback method which gives you access to an error object (if applicable), the default server, and the secure server (if launched). This can be done with or without options provided.

require('simple-secure-server', app, [options, ] function (err, default, secure) {
    // ...
});

Configuration

The module accepts a configuration object as an optional second parameter.

require('simple-secure-server')(app, {
    ports: {
        default: 80
    }
});

Options

ports Specify which ports should be used

  • May be be an Integer or String;
  • Defaults to 80 for default and 443 for secure

secure Launches secure server

  • Must be a Boolean;
  • Defaults to false

secureRedirect Redirects requests from http:// to https://

  • Must be a Boolean;
  • Defaults to true, when secure server is available.

files Paths to certificate files

  • Must be an Array valid file paths;
  • The first element must be the .key file, and the second .crt.

TODO

  • Allow only launching SSL server
  • Launch server based on config and certificate files
  • Make options parameter optional
  • Allow custom listeners
0.4.0

9 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago