Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-servers

Package Overview
Dependencies
Maintainers
5
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-servers - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

16

index.js

@@ -44,3 +44,4 @@ 'use strict';

module.exports = function createServers(options, listening) {
if (!options || (!options.http && !options.https)
if (!options
|| (typeof options.http === 'undefined' && typeof options.https === 'undefined')
|| (!options.handler && !options.http.handler && !options.https.handler)) {

@@ -91,3 +92,3 @@ return listening(new Error('handler, http and/or https are required options.'));

function createHttp() {
if (!options.http) {
if (typeof options.http === 'undefined') {
log('http | no options.http; no server');

@@ -99,6 +100,3 @@ return onListen('http');

options.http = {
// accept both a string and a number
port: !isNaN(options.http)
? +options.http
: false
port: options.http
};

@@ -108,3 +106,3 @@ }

var server = http.createServer(options.http.handler || handler),
port = options.http.port || 80,
port = !isNaN(options.http.port) ? +options.http.port : 80, // accepts string or number
args;

@@ -127,3 +125,3 @@

function createHttps(next) {
if (!options.https) {
if (typeof options.https === 'undefined') {
log('https | no options.https; no server');

@@ -134,3 +132,3 @@ return onListen('https');

var ssl = options.https,
port = +ssl.port || 443,
port = !isNaN(ssl.port) ? +ssl.port : 443, // accepts string or number
ciphers = ssl.ciphers || CIPHERS,

@@ -137,0 +135,0 @@ ca = ssl.ca,

{
"name": "create-servers",
"version": "2.2.0",
"version": "2.2.1",
"description": "Create an http AND/OR an https server and call the same request handler.",

@@ -31,4 +31,4 @@ "main": "index.js",

"sinon": "^1.17.4",
"tape": "~2.14.0"
"tape": "~4.6.0"
}
}

@@ -38,2 +38,19 @@ /*

test('only http, port 0', function (t) {
t.plan(4);
createServers({
log: console.log,
http: 0,
handler: fend
}, function (err, servers) {
console.dir(err);
t.error(err);
t.equals(typeof servers, 'object');
t.equals(typeof servers.http, 'object');
t.equals(typeof servers.http.address().port, 'number');
servers.http.close();
});
});
test('only https', function (t) {

@@ -40,0 +57,0 @@ t.plan(3);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc