Class: abstract
Middleware<Options>
Since
1.0.0
Extends
Piece
<Options
,"middlewares"
>
Type Parameters
Type Parameter | Default type |
---|---|
Options extends Options | Options |
Constructors
new Middleware()
new Middleware<
Options
>(context
:LoaderContext
,options
:Options
):Middleware
<Options
>
Parameters
Parameter | Type |
---|---|
context | LoaderContext |
options | Options |
Returns
Middleware
<Options
>
Overrides
Piece<Options, 'middlewares'>.constructor
Defined in
projects/plugins/packages/api/src/lib/structures/Middleware.ts:22
Properties
position
readonly
position:number
The position the middleware has. The MiddlewareStore will run all middlewares with lower position than this one.
The built-in middlewares follow the following positions:
- headers: 10
- body: 20
- cookies: 30
- auth: 40
Defined in
projects/plugins/packages/api/src/lib/structures/Middleware.ts:20
Methods
run()
abstract
run(request
:ApiRequest
,response
:Response
):unknown
The method to be overridden by other middlewares.
Parameters
Parameter | Type | Description |
---|---|---|
request | ApiRequest | The client's request. |
response | Response | The server's response. |
Returns
unknown
Defined in
projects/plugins/packages/api/src/lib/structures/Middleware.ts:33