I am using a @SetMetaData('version', 'v2')
to set versioning for a http method in a controller.
Then I have a custom @Get()
decorator to add the version as a postfix to the controller route.
So that, I would be able to use /api/cats/v2/firstfive
, when I have
@SetMetaData('version', 'v2')
@Get('firstfive')
But I don't see a clear way to inject Reflector to my custom @Get decorator.
My Get decorator is as follows,
import { Get as _Get } from '@nestjs/common';
export function Get(path?: string) {
version = /*this.reflector.get('version') or something similar */
return applyDecorators(_Get(version+path));
}
Please Help me out here!
Thanks!