如何在 NEST JS 中为 specific/different 请求方法处理多个中间件?

How to handle multiple middlewares in NEST JS for specific/different request methods?

Explaining my code below: There are two middleware AuthenticationMiddleware, RequestFilterMiddleware which intervene ALL request methods.

我的问题 是如何为 GET 方法制作 RequestFilterMiddleware 中间件和为所有请求方法制作 AuthenticationMiddleware 中间件

app.module.ts

export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer
      .apply(AuthenticationMiddleware, RequestFilterMiddleware)
      .forRoutes({ path: '/**', method: RequestMethod.ALL });
  }
}

应该可以,不是吗?

export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer
      .apply(AuthenticationMiddleware)
      .forRoutes({ path: '/**', method: RequestMethod.ALL });
    consumer
      .apply(RequestFilterMiddleware)
      .forRoutes({ path: '/**', method: RequestMethod.GET });
  }
}