Skip to content

Instantly share code, notes, and snippets.

@Supamiu
Created December 10, 2019 07:52
Show Gist options
  • Save Supamiu/1bfdd108af16168b12494cfd6c2584f7 to your computer and use it in GitHub Desktop.
Save Supamiu/1bfdd108af16168b12494cfd6c2584f7 to your computer and use it in GitHub Desktop.
Apollo's example to get started with the library on Angular
import { HttpClientModule } from "@angular/common/http";
import { ApolloModule, APOLLO_OPTIONS } from "apollo-angular";
import { HttpLinkModule, HttpLink } from "apollo-angular-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
@NgModule({
imports: [
BrowserModule,
HttpClientModule,
ApolloModule,
HttpLinkModule
],
providers: [{
provide: APOLLO_OPTIONS,
useFactory: (httpLink: HttpLink) => {
return {
cache: new InMemoryCache(),
link: httpLink.create({
uri: "https://o5x5jzoo7z.sse.codesandbox.io/graphql"
})
}
},
deps: [HttpLink]
}],
})
export class AppModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment