【发布时间】:2021-08-30 07:48:30
【问题描述】:
我必须将出现在我的应用程序中不同位置的所有装饰器值作为字符串收集,然后在运行时将它们保存到数据库中,我不必添加它们两次(在数据库和代码中),
我尝试过这样做,但我不知道我在使用
Reflector来自nestjs的api如下
this.reflector.getAll<string>('access', context.getHandler())
但我在运行时无法获得context.getHandler()
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalPipes(new ValidationPipe());
// Here is where i want to save
await app.listen(3000);
}
bootstrap();
这是我的装饰器
@HashPermission('access_value')
请帮忙
【问题讨论】:
标签: javascript node.js typescript nestjs