我必须收集出现在应用程序中不同位置的所有装饰器值作为字符串,然后在运行时将它们保存到数据库中,我不必将它们添加两次(在数据库和代码中),
我尝试过这样做,但我不知道我使用
Reflector来自 Nestjs 的 api 如下
this.reflector.getAll<string>('access', context.getHandler())
Run Code Online (Sandbox Code Playgroud)
但我无法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();
Run Code Online (Sandbox Code Playgroud)
这是我的装饰器
@HashPermission('access_value')
Run Code Online (Sandbox Code Playgroud)
请协助