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

types/registry/Middlewares/BaseMiddlewareType.ts:29

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

types/registry/Middlewares/BaseMiddlewareType.ts:56


setApplicationMiddlewareOptions()

setApplicationMiddlewareOptions(): MiddlewareOptions

Set the details for this middleware.

Returns

MiddlewareOptions

Defined in

types/registry/Middlewares/BaseMiddlewareType.ts:69