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

@ms-cloudpack/create-express-app

Package Overview
Dependencies
Maintainers
3
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/create-express-app - npm Package Compare versions

Comparing version 1.3.17 to 1.4.0

5

lib/createExpressApp.d.ts

@@ -12,4 +12,7 @@ /// <reference types="node" resolution-mode="require"/>

publicDir?: string;
middlewareMode?: boolean;
server?: Server;
}): Promise<{
server: Server;
app: Express;
server: Server | undefined;
close: () => Promise<void>;

@@ -16,0 +19,0 @@ url: string;

13

lib/createExpressApp.js

@@ -8,3 +8,3 @@ import express, {} from 'express';

export async function createExpressApp(options) {
const { setupCallback, hostname, sslOptions, requireSpecifiedPort, publicDir, portRange: ports } = options;
const { setupCallback, hostname, sslOptions, requireSpecifiedPort, publicDir, portRange: ports, middlewareMode, } = options;
const portRange = typeof ports === 'number' ? [ports] : ports;

@@ -30,3 +30,3 @@ if (requireSpecifiedPort && (portRange === undefined || portRange.length === 0)) {

const domain = hostname || 'localhost';
let server;
let server = options.server;
const protocol = sslOptions && Object.keys(sslOptions).length !== 0 ? 'https' : 'http';

@@ -39,3 +39,3 @@ let url = `${protocol}://${domain}`;

await setupCallback?.(app, url);
if (sslOptions && Object.keys(sslOptions).length !== 0) {
if (!middlewareMode && sslOptions && Object.keys(sslOptions).length !== 0) {
// Create an HTTPS server.

@@ -45,3 +45,3 @@ const httpsServer = https.createServer(parseHttpsConfig(sslOptions), app);

}
else {
else if (!middlewareMode) {
// Create an HTTP server.

@@ -52,3 +52,3 @@ server = app.listen(port, domain);

const sockets = new Set();
server.on('connection', (socket) => {
server?.on('connection', (socket) => {
sockets.add(socket);

@@ -60,2 +60,3 @@ socket.on('close', () => {

return {
app,
server,

@@ -67,3 +68,3 @@ async close() {

sockets.clear();
await new Promise((resolve, reject) => server.close((err) => (err ? reject(err) : resolve())));
await new Promise((resolve, reject) => server?.close((err) => (err ? reject(err) : resolve())));
},

@@ -70,0 +71,0 @@ url,

import * as express from 'express';
export type { Express, Request, Response } from 'express';
export type { Express, Request, Response, Router } from 'express';
export { createExpressApp } from './createExpressApp.js';

@@ -4,0 +4,0 @@ export { type HttpsConfig, parseHttpsConfig } from './parseHttpsConfig.js';

{
"name": "@ms-cloudpack/create-express-app",
"version": "1.3.17",
"version": "1.4.0",
"description": "Helper for creating an express app server, abstracting a common plugin setup.",

@@ -17,3 +17,3 @@ "license": "MIT",

"dependencies": {
"@ms-cloudpack/path-utilities": "^2.4.3",
"@ms-cloudpack/path-utilities": "^2.5.0",
"@types/express": "^4.17.16",

@@ -20,0 +20,0 @@ "compression": "^1.7.4",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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