Skip to content

Instantly share code, notes, and snippets.

@vitorpiovezam
Last active August 7, 2019 23:00
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 vitorpiovezam/7454d7a6f14042f590b1d67e469195b3 to your computer and use it in GitHub Desktop.
Save vitorpiovezam/7454d7a6f14042f590b1d67e469195b3 to your computer and use it in GitHub Desktop.
import { NgModule } from '@angular/core';
import { ApolloModule, Apollo } from 'apollo-angular';
import { HttpClientModule } from '@angular/common/http';
import { HttpLinkModule, HttpLink } from 'apollo-angular-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
@NgModule({
imports:[
HttpClientModule,
ApolloModule,
HttpLinkModule
]
})
export class ApolloConfigModule {
constructor(
private apollo: Apollo,
private httpLink: HttpLink
){
const uri = 'https://api.graph.cool/simple/v1/cjmi9259f0t5a9c'; // Your endpoint goes here
const http = httpLink.create({ uri });
apollo.create({
link: http,
cache: new InMemoryCache(),
connectToDevTools: true
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment