Nestjs v5.0.0护照影响到所有路线

时间:2018-05-14 08:44:38

标签: jwt passport.js nestjs

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

1 个答案:

答案 0 :(得分:0)

Here是问题的解决方案