In my app.module
providers: [UserService,
{ provide: BFF_URL, useValue: environment.bffUrl },
],
Then in my graphql.module (nx library):
export function createDefaultApollo(httpLink: HttpLink, @Inject(BFF_URL) baseUrl: string): ApolloClientOptions<any> {
const cache = new InMemoryCache({});
// create http
const http = httpLink.create({
uri: baseUrl + '/graphql',
});
return {
connectToDevTools: false,
assumeImmutableResults: true,
cache,
link: ApolloLink.from([basicContext, errorLink, http]),
defaultOptions: {
watchQuery: {
fetchPolicy: 'cache-and-network',
errorPolicy: 'all',
},
query: {
fetchPolicy: 'cache-first',
errorPolicy: 'all',
},
mutate: {
errorPolicy: 'all'
}
},
};
}
@NgModule({
imports: [CommonModule, HttpClientModule, ApolloModule],
providers: [
{
provide: APOLLO_OPTIONS,
useFactory: createDefaultApollo,
deps: [HttpLink, BFF_URL],
},
],
})
export class GraphQLModule {
}
it doesnt like @Inject(BFF_URL) baseUrl: string. How can i solve this?