You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
frontend/src/app/graphql.module.ts

25 lines
697 B
TypeScript

import {NgModule} from '@angular/core';
import {APOLLO_OPTIONS} from 'apollo-angular';
4 years ago
import {ApolloClientOptions, ApolloLink, InMemoryCache} from '@apollo/client/core';
import {HttpLink} from 'apollo-angular/http';
import { environment } from '../environments/environment';
const uri = environment.apiUrl + '/graphql'; // <-- add the URL of the GraphQL server here
export function createApollo(httpLink: HttpLink): ApolloClientOptions<any> {
return {
link: httpLink.create({uri}),
4 years ago
cache: new InMemoryCache({}),
};
}
@NgModule({
providers: [
{
provide: APOLLO_OPTIONS,
useFactory: createApollo,
deps: [HttpLink],
},
],
})
4 years ago
export class GraphQLModule {
}