Skip to content

Instantly share code, notes, and snippets.

@orlaqp
Created January 8, 2017 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orlaqp/0635a66aef2724cf6c8e2bdcba6dbeaa to your computer and use it in GitHub Desktop.
Save orlaqp/0635a66aef2724cf6c8e2bdcba6dbeaa to your computer and use it in GitHub Desktop.
// Apollo
import ApolloClient, { createNetworkInterface } from 'apollo-client';
import { ApolloModule } from 'angular2-apollo';
// by default, this client will send queries to `/graphql` (relative to the URL of your app)
const client = new ApolloClient({
networkInterface: createNetworkInterface({
uri: 'http://localhost:8081'
}),
});
export function provideClient(): ApolloClient {
return client;
}
...
@NgModule({
imports: [
BrowserModule,
HttpModule,
FormsModule,
ReactiveFormsModule,
routing,
// Apollo
ApolloModule.withClient(provideClient),
],
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment