Skip to main content

Class: MiddlewareController

The Middleware Controller, The base class for Middleware which is used in middleware files.

MiddlewareController

Constructors

new MiddlewareController()

new MiddlewareController(application, container, logger, utilities): MiddlewareController

Parameters

application: Express

container: Record<string, any> & Locals

logger: Logger

utilities: UtilitiesType

Returns

MiddlewareController

Defined in

registry/types/Middlewares/BaseMiddlewareType.ts:34

Methods

run()

run(_request, _response, next): void | Response<any, Record<string, any>> | Promise<void | Response<any, Record<string, any>>>

The run function for this middleware, this function cannot be redefined to use another name, but only the content within the function.

Placeholder run function if nothing is defined:

Parameters

_request: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

_response: Response<any, Record<string, any>>

next: NextFunction

Returns

void | Response<any, Record<string, any>> | Promise<void | Response<any, Record<string, any>>>

Example

return next();

@public

Defined in

registry/types/Middlewares/BaseMiddlewareType.ts:61


setApplicationMiddlewareOptions()

setApplicationMiddlewareOptions(): MiddlewareOptions

Set the details for this middleware.

Returns

MiddlewareOptions

Defined in

registry/types/Middlewares/BaseMiddlewareType.ts:74