@ms-cloudpack/create-express-app
Advanced tools
Comparing version 1.4.4 to 1.5.0
@@ -9,2 +9,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
hostname?: string; | ||
requestHeaders?: Record<string, string>; | ||
sslOptions?: HttpsConfig; | ||
@@ -11,0 +12,0 @@ setupCallback?: (app: Express, baseUrl: string) => void | Promise<void>; |
@@ -9,3 +9,3 @@ import compression from 'compression'; | ||
export async function createExpressApp(options) { | ||
const { setupCallback, hostname, sslOptions, requireSpecifiedPort, publicDir, portRange: ports, middlewareMode, } = options; | ||
const { setupCallback, hostname, requestHeaders = {}, sslOptions, requireSpecifiedPort, publicDir, portRange: ports, middlewareMode, } = options; | ||
const portRange = typeof ports === 'number' ? [ports] : ports; | ||
@@ -27,2 +27,8 @@ if (requireSpecifiedPort && (portRange === undefined || portRange.length === 0)) { | ||
app.use(compression()); | ||
app.use((_, res, next) => { | ||
for (const [headerName, headerValue] of Object.entries(requestHeaders)) { | ||
res.setHeader(headerName, headerValue); | ||
} | ||
next(); | ||
}); | ||
if (publicDir !== undefined) { | ||
@@ -29,0 +35,0 @@ app.use(express.static(publicDir, { index: false })); |
{ | ||
"name": "@ms-cloudpack/create-express-app", | ||
"version": "1.4.4", | ||
"version": "1.5.0", | ||
"description": "Helper for creating an express app server, abstracting a common plugin setup.", | ||
@@ -17,3 +17,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@ms-cloudpack/config-types": "^0.5.1", | ||
"@ms-cloudpack/config-types": "^0.6.0", | ||
"@ms-cloudpack/path-utilities": "^2.6.0", | ||
@@ -20,0 +20,0 @@ "@types/express": "^4.17.16", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22854
199
+ Added@ms-cloudpack/config-types@0.6.0(transitive)
- Removed@ms-cloudpack/config-types@0.5.1(transitive)