Function: Middleware()
Function: Middleware()
function Middleware<T>(options): ClassDecorator;
Middleware decorator to mark a class as middleware within the Stone.js framework.
This decorator is used to customize classes as middleware, allowing them to be registered and managed as part of the request/response lifecycle or other layers such as adapter, kernel, or router.
Type Parameters
T
T
extends ClassType
= ClassType
Parameters
options
MiddlewareOptions
= {}
The configuration options for the middleware, including platform, priority, singleton registration, alias, layer, and type.
Returns
ClassDecorator
A decorator function to set metadata on the target class.
Example
@Middleware({ params: ['node'], priority: 1, global: true, alias: 'MyMiddleware' })
class MyMiddleware {
// Middleware class logic here.
}