Interface for modules that configure middleware
Implement this interface in your module class to configure middleware using the consumer pattern.
@Module({ providers: [...] })export class AppModule implements MiddlewareConfigurable { configure(consumer: MiddlewareConsumer): void { consumer .apply(LoggingMiddleware, CorsMiddleware) .exclude({ path: '/health', method: 'get' }) .forRoutes('*') consumer .apply(CorsMiddleware) .forRoutes(ApiController, WebhooksController) }} Copy
@Module({ providers: [...] })export class AppModule implements MiddlewareConfigurable { configure(consumer: MiddlewareConsumer): void { consumer .apply(LoggingMiddleware, CorsMiddleware) .exclude({ path: '/health', method: 'get' }) .forRoutes('*') consumer .apply(CorsMiddleware) .forRoutes(ApiController, WebhooksController) }}
Configure middleware for this module
Middleware consumer for fluent configuration
Interface for modules that configure middleware
Implement this interface in your module class to configure middleware using the consumer pattern.
Example