push
This commit is contained in:
@@ -4,6 +4,7 @@ import { NgModule } from '@angular/core';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { GraphQLModule } from './graphql.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -12,7 +13,8 @@ import { HttpClientModule } from '@angular/common/http';
|
||||
imports: [
|
||||
HttpClientModule,
|
||||
BrowserModule,
|
||||
AppRoutingModule
|
||||
AppRoutingModule,
|
||||
GraphQLModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular';
|
||||
import {HttpLinkModule, HttpLink} from 'apollo-angular-link-http';
|
||||
import {InMemoryCache} from 'apollo-cache-inmemory';
|
||||
|
||||
const uri = ''; // <-- add the URL of the GraphQL server here
|
||||
export function createApollo(httpLink: HttpLink) {
|
||||
return {
|
||||
link: httpLink.create({uri}),
|
||||
cache: new InMemoryCache(),
|
||||
};
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
exports: [ApolloModule, HttpLinkModule],
|
||||
providers: [
|
||||
{
|
||||
provide: APOLLO_OPTIONS,
|
||||
useFactory: createApollo,
|
||||
deps: [HttpLink],
|
||||
},
|
||||
],
|
||||
})
|
||||
export class GraphQLModule {}
|
||||
Reference in New Issue
Block a user