@autofleet/super-express
Advanced tools
Comparing version 4.0.0 to 4.1.0
{ | ||
"name": "@autofleet/super-express", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "AF Express with built in boilerplate", | ||
@@ -15,4 +15,3 @@ "main": "src/index.js", | ||
"scripts": { | ||
"test": "node --test test/index.test.js", | ||
"publish": "npm publish" | ||
"test": "node --test test/index.test.js" | ||
}, | ||
@@ -19,0 +18,0 @@ "repository": { |
import * as express from 'express'; | ||
declare namespace SuperExpress { | ||
/** | ||
* Options to customize the behavior of the SuperExpress application. | ||
*/ | ||
export interface DefaultOptions { | ||
/** | ||
* Options to customize the behavior of the SuperExpress application. | ||
* Enables or disables body parser middleware. | ||
*/ | ||
interface DefaultOptions { | ||
/** | ||
* Enables or disables body parser middleware. | ||
*/ | ||
bodyParser?: boolean; | ||
/** | ||
* Enables or disables security headers middleware. | ||
*/ | ||
helmet?: boolean; | ||
/** | ||
* Enables or disables HTTP request logging middleware. | ||
*/ | ||
morgan?: boolean; | ||
/** | ||
* Enables or disables the alive endpoint middleware. | ||
*/ | ||
nitur?: boolean; | ||
/** | ||
* Enables or disables the stats endpoint middleware. | ||
*/ | ||
stats?: boolean; | ||
/** | ||
* Path to the package.json file for the stats endpoint. | ||
*/ | ||
packageJsonPath?: string; | ||
/** | ||
* Enables or disables request tracing middleware. | ||
*/ | ||
tracing?: boolean; | ||
/** | ||
* Enables or disables eager loading of user permissions for tracing middleware. | ||
*/ | ||
eagerLoadUserPermissions?: boolean; | ||
/** | ||
* Options to customize the alive endpoint middleware. | ||
*/ | ||
aliveEndpointOptions?: Record<string, unknown>; | ||
// Add other options from config/default-options.json as needed | ||
} | ||
bodyParser?: boolean; | ||
/** | ||
* Type for the callback function used in the listen method. | ||
* Enables or disables security headers middleware. | ||
*/ | ||
type ListenCallback = () => void; | ||
helmet?: boolean; | ||
/** | ||
* Enables or disables HTTP request logging middleware. | ||
*/ | ||
morgan?: boolean; | ||
/** | ||
* Enables or disables the alive endpoint middleware. | ||
*/ | ||
nitur?: boolean; | ||
/** | ||
* Enables or disables the stats endpoint middleware. | ||
*/ | ||
stats?: boolean; | ||
/** | ||
* Path to the package.json file for the stats endpoint. | ||
*/ | ||
packageJsonPath?: string; | ||
/** | ||
* Enables or disables request tracing middleware. | ||
*/ | ||
tracing?: boolean; | ||
/** | ||
* Enables or disables eager loading of user permissions for tracing middleware. | ||
*/ | ||
eagerLoadUserPermissions?: boolean; | ||
/** | ||
* Options to customize the alive endpoint middleware. | ||
*/ | ||
aliveEndpointOptions?: Record<string, unknown>; | ||
// Add other options from config/default-options.json as needed | ||
} | ||
type Listen = express.Application['listen']; | ||
type Server = Listen extends (port: any, cb: any) => infer R ? R : never; | ||
/** | ||
* Type for the callback function used in the listen method. | ||
*/ | ||
export type ListenCallback = () => void; | ||
type Listen = express.Application['listen']; | ||
type Server = Listen extends (port: any, cb: any) => infer R ? R : never; | ||
/** | ||
* Extends the express.Application interface to include nativeListen and the overridden listen method. | ||
*/ | ||
export interface SuperExpressApp extends express.Application { | ||
/** | ||
* Extends the express.Application interface to include nativeListen and the overridden listen method. | ||
* Original express listen method. | ||
*/ | ||
interface SuperExpressApp extends express.Application { | ||
/** | ||
* Original express listen method. | ||
*/ | ||
nativeListen: Listen; | ||
nativeListen: Listen; | ||
/** | ||
* Overridden listen method to add custom behavior. | ||
* @param port - The port number to listen on. | ||
* @param cb - Optional callback function to execute after the server starts listening. | ||
*/ | ||
listen(port: number, cb?: ListenCallback): Server; | ||
} | ||
/** | ||
* Creates a new SuperExpress application with the given options. | ||
* @param options - Optional settings to customize the application. | ||
* @returns A SuperExpress application instance. | ||
* Overridden listen method to add custom behavior. | ||
* @param port - The port number to listen on. | ||
* @param cb - Optional callback function to execute after the server starts listening. | ||
*/ | ||
function createSuperExpressApp( | ||
options?: Partial<DefaultOptions & express.ApplicationOptions> | ||
): SuperExpressApp; | ||
listen(port: number, cb?: ListenCallback): Server; | ||
} | ||
export = SuperExpress; | ||
/** | ||
* Creates a new SuperExpress application with the given options. | ||
* @param options - Optional settings to customize the application. | ||
* @returns A SuperExpress application instance. | ||
*/ | ||
declare function createSuperExpressApp( | ||
options?: Partial<DefaultOptions & express.ApplicationOptions> | ||
): SuperExpressApp; | ||
export = createSuperExpressApp; |
12336
235