Created
December 10, 2019 07:52
-
-
Save Supamiu/1bfdd108af16168b12494cfd6c2584f7 to your computer and use it in GitHub Desktop.
Apollo's example to get started with the library on Angular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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