Middleware API Reference
Middleware Interface
interface MiddlewareInterface {
use(
context: ExecutionContext,
next: () => Promise<any>
): Promise<any>;
}
Example
@Middleware()
export class MyMiddleware implements MiddlewareInterface {
async use(context: ExecutionContext, next: () => Promise<any>): Promise<any> {
// Before
const result = await next();
// After
return result;
}
}