Reputation: 362
I'd like to create a custom provider for a request-scoped resource, combining these styles:
https://docs.nestjs.com/fundamentals/custom-providers#use-factory https://docs.nestjs.com/fundamentals/injection-scopes#request-provider
I'm not sure if it's possible, or what the correct markup of the custom provider is if so.
Upvotes: 2
Views: 736
Reputation: 3672
In fact you can do that by passing the scope property along the factory
Here is the link to the interface https://github.com/nestjs/nest/blob/master/packages/common/interfaces/modules/provider.interface.ts
Upvotes: 2