Skip to content

Commit

Permalink
chore: several config fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jul 25, 2023
1 parent 0894143 commit 391dc12
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/express-support/src/builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export class ExpressBuilder {
private existingExpress?: Express
private hostnameOrIP?: string
private port?: number
private _handlers: ApplicationRequestHandler<Application>[]
private _handlers?: ApplicationRequestHandler<Application>[] = []
private listenCallback?: () => void
private _startListen: boolean | undefined = undefined
private _startListen?: boolean | undefined = undefined
private readonly envVarPrefix?: string
private _corsConfigurer?: ExpressCorsConfigurer
private _sessionOpts?: session.SessionOptions
private _usePassportAuth: boolean = false
private _usePassportAuth?: boolean = false
private _passportInitOpts?: InitializeOptions
private _userIsInRole?: string | string[]
private _enforcer?: Enforcer
Expand Down Expand Up @@ -132,6 +132,9 @@ export class ExpressBuilder {
if (Array.isArray(handlers)) {
this._handlers = handlers
} else if (handlers) {
if (!this._handlers) {
this._handlers = []
}
this._handlers.push(handlers)
} else {
this._handlers = []
Expand All @@ -141,6 +144,9 @@ export class ExpressBuilder {
}

public addHandler(handler: ApplicationRequestHandler<any>): this {
if (!this._handlers) {
this._handlers = []
}
this._handlers.push(handler)
return this
}
Expand Down

0 comments on commit 391dc12

Please sign in to comment.