@ms-cloudpack/create-express-app
Advanced tools
Comparing version 0.1.1 to 1.0.0
@@ -5,3 +5,24 @@ { | ||
{ | ||
"date": "Wed, 28 Sep 2022 08:14:45 GMT", | ||
"date": "Tue, 18 Oct 2022 08:15:52 GMT", | ||
"tag": "@ms-cloudpack/create-express-app_v1.0.0", | ||
"version": "1.0.0", | ||
"comments": { | ||
"major": [ | ||
{ | ||
"author": "dake.3601@gmail.com", | ||
"package": "@ms-cloudpack/create-express-app", | ||
"commit": "1bec1f80bb50ebe897f03dc74437c3e211bea83e", | ||
"comment": "Https express app can be created with options and domain." | ||
}, | ||
{ | ||
"author": "beachball", | ||
"package": "@ms-cloudpack/create-express-app", | ||
"comment": "Bump @ms-cloudpack/path-utilities to v1.1.0", | ||
"commit": "1bec1f80bb50ebe897f03dc74437c3e211bea83e" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Wed, 28 Sep 2022 08:15:16 GMT", | ||
"tag": "@ms-cloudpack/create-express-app_v0.1.1", | ||
@@ -8,0 +29,0 @@ "version": "0.1.1", |
# Change Log - @ms-cloudpack/create-express-app | ||
This log was last generated on Wed, 28 Sep 2022 08:14:45 GMT and should not be manually modified. | ||
This log was last generated on Tue, 18 Oct 2022 08:15:52 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 1.0.0 | ||
Tue, 18 Oct 2022 08:15:52 GMT | ||
### Major changes | ||
- Https express app can be created with options and domain. (dake.3601@gmail.com) | ||
- Bump @ms-cloudpack/path-utilities to v1.1.0 | ||
## 0.1.1 | ||
Wed, 28 Sep 2022 08:14:45 GMT | ||
Wed, 28 Sep 2022 08:15:16 GMT | ||
@@ -11,0 +20,0 @@ ### Patches |
/// <reference types="node" resolution-mode="require"/> | ||
import { type Express } from 'express'; | ||
import type { Server } from 'http'; | ||
export declare function createExpressApp(portRange: number[], setupCallback: (app: Express) => void): Promise<{ | ||
import type { HttpsConfig } from './parseHttpsConfig.js'; | ||
export declare function createExpressApp(options: { | ||
portRange?: number | number[]; | ||
hostname?: string; | ||
sslOptions?: HttpsConfig; | ||
setupCallback?: (app: Express) => void; | ||
}): Promise<{ | ||
server: Server; | ||
protocol: 'http' | 'https'; | ||
domain: string; | ||
port: number; | ||
}>; | ||
export type { Express }; |
import express, {} from 'express'; | ||
import https from 'https'; | ||
import cors from 'cors'; | ||
import compression from 'compression'; | ||
import getPort from 'get-port'; | ||
export async function createExpressApp(portRange, setupCallback) { | ||
export async function createExpressApp(options) { | ||
const { setupCallback, hostname, sslOptions, portRange } = options; | ||
// Get the available port. | ||
@@ -16,7 +18,20 @@ const port = await getPort({ | ||
// Call setup callback with the app. | ||
setupCallback(app); | ||
// Listen on port. | ||
const server = app.listen(port); | ||
setupCallback?.(app); | ||
const domain = hostname || 'localhost'; | ||
let server = undefined; | ||
let protocol = 'http'; | ||
if (sslOptions && Object.keys(sslOptions).length !== 0) { | ||
// Create an HTTPS server. | ||
const httpsServer = https.createServer(sslOptions, app); | ||
server = httpsServer.listen(port, domain); | ||
protocol = 'https'; | ||
} | ||
else { | ||
// Create an HTTP server. | ||
server = app.listen(port, domain); | ||
} | ||
return { | ||
server, | ||
protocol, | ||
domain, | ||
port, | ||
@@ -23,0 +38,0 @@ }; |
export { createExpressApp } from './createExpressApp.js'; | ||
export type { Express, Request, Response } from 'express'; | ||
export { parseHttpsConfig, type HttpsConfig } from './parseHttpsConfig.js'; |
export { createExpressApp } from './createExpressApp.js'; | ||
export { parseHttpsConfig } from './parseHttpsConfig.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.31.2" | ||
"packageVersion": "7.33.1" | ||
} | ||
] | ||
} |
{ | ||
"name": "@ms-cloudpack/create-express-app", | ||
"version": "0.1.1", | ||
"version": "1.0.0", | ||
"description": "Helper for creating an express app server, abstracting a common plugin setup.", | ||
@@ -16,2 +16,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@ms-cloudpack/path-utilities": "^1.1.0", | ||
"compression": "^1.7.4", | ||
@@ -36,3 +37,6 @@ "cors": "^2.8.5", | ||
"lint:update": "cloudpack-scripts lint-update", | ||
"lint": "cloudpack-scripts lint" | ||
"lint": "cloudpack-scripts lint", | ||
"test:update": "cloudpack-scripts test-update", | ||
"test:watch": "cloudpack-scripts test-watch", | ||
"test": "cloudpack-scripts test" | ||
}, | ||
@@ -39,0 +43,0 @@ "files": [ |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
15741
17
266
1
5
3
1
+ Added@ms-cloudpack/path-string-parsing@1.2.4(transitive)
+ Added@ms-cloudpack/path-utilities@1.1.1(transitive)