我正在将我的代码更新到 v5,并且我希望有一个像我在上一个代码中那样影响所有路线的病房,但我不知道如何在新版本中做到这一点。我附上我的旧代码。
@Module({
components: [AuthService, JwtStrategy, Config],
controllers: [AuthenticateController],
})
export class AuthModule implements NestModule {
public configure(consumer: MiddlewaresConsumer) {
consumer
.apply(passport.authenticate('jwt', { session: false }))
.forRoutes({ path: '*', method: RequestMethod.ALL });
}
}