I have a project using tsyringe and a RESTFul API. Now i should to add a GraphQL API using the type-graphql but in our documentation no have some example using it.
Is possiblem to use tsyringe to make DI with TypeGraphQL?
I have a project using tsyringe and a RESTFul API. Now i should to add a GraphQL API using the type-graphql but in our documentation no have some example using it.
Is possiblem to use tsyringe to make DI with TypeGraphQL?
Yes, it's possible!
Most IOC containers have the
getfunction to retrieve an instance of the given class type.tsyringeinstead have theresolvefunction.Therefore, you have to change the
containeroption when building the schema to instructtype-graphqlhow to retrieve (get) a class instance from a class type: