diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1772d4d7f11fc8709c44375d05a417730ddbf4ec..58e200c0c83be8a7c5aea43b9ea7898f73b4a401 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,6 +2,11 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import "@angular/compiler"; +import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular'; +import {HttpLink} from 'apollo-angular/http'; +import {HttpClientModule} from '@angular/common/http'; +import {InMemoryCache} from '@apollo/client/core'; + import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @@ -12,6 +17,8 @@ import { MatTableModule } from '@angular/material/table'; import { BestandComponent } from './bestand/bestand.component'; +const graphQL = '/api/'; + @NgModule({ declarations: [ AppComponent, @@ -21,12 +28,27 @@ import { BestandComponent } from './bestand/bestand.component'; BrowserModule, AppRoutingModule, BrowserAnimationsModule, + HttpClientModule, + ApolloModule, MatToolbarModule, MatIconModule, MatTabsModule, MatTableModule ], - providers: [], - bootstrap: [AppComponent] + providers: [ + { + provide: APOLLO_OPTIONS, + useFactory(httpLink: HttpLink) { + return { + cache: new InMemoryCache(), + link: httpLink.create({ + uri: graphQL, + }), + }; + }, + deps: [HttpLink], + }, + ], + bootstrap: [AppComponent], }) export class AppModule { }