我正在将我的代码更新为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 });
}
}