【发布时间】:2020-12-11 17:18:19
【问题描述】:
// jwt guard
@UseGuards(AuthStrategyGuard)
@Controller('users')
export class UsersController {
constructor(private readonly authService: AuthService, private readonly usersService: UsersService) {}
@Post()
async getIndex (@Body() body) {
if (!body.user) {
throw new UnauthorizedException('error auth');
} else {
const token = await this.authService.sign(body);
return { token }
}
}
@Post('auth')
validating (@Body('token') token) {
console.log(token, 'token');
return {success: 1}
}
@Post('test')
getTestIndex () {
return {success: 1}
}
}
这里是 JSONWebToken 验证逻辑
我想从 JWT 验证中排除 @post () 装饰器
我该怎么办?
【问题讨论】:
标签: javascript node.js nestjs