| @@ -0,0 +1,12 @@ | |||
| overwrite: true | |||
| schema: "http://localhost:4000" | |||
| documents: "src/**/*.graphql" | |||
| generates: | |||
| src/generated/graphql.ts: | |||
| plugins: | |||
| - "typescript" | |||
| - "typescript-operations" | |||
| - "typescript-apollo-angular" | |||
| ./graphql.schema.json: | |||
| plugins: | |||
| - "introspection" | |||
| @@ -7,7 +7,8 @@ | |||
| "build": "ng build", | |||
| "test": "ng test", | |||
| "lint": "ng lint", | |||
| "e2e": "ng e2e" | |||
| "e2e": "ng e2e", | |||
| "generate": "graphql-codegen --config codegen.yml" | |||
| }, | |||
| "private": true, | |||
| "dependencies": { | |||
| @@ -22,7 +23,12 @@ | |||
| "@angular/platform-browser-dynamic": "~10.0.4", | |||
| "@angular/router": "~10.0.4", | |||
| "apollo-angular": "^1.10.0", | |||
| "rxjs": "~6.5.5", | |||
| "apollo-angular-link-http": "^1.11.0", | |||
| "apollo-cache-inmemory": "^1.6.0", | |||
| "apollo-client": "^2.6.0", | |||
| "apollo-link": "^1.2.11", | |||
| "graphql": "^14.7.0", | |||
| "graphql-tag": "^2.10.0", | |||
| "tslib": "^2.0.0", | |||
| "zone.js": "~0.10.3" | |||
| }, | |||
| @@ -30,9 +36,10 @@ | |||
| "@angular-devkit/build-angular": "~0.1000.3", | |||
| "@angular/cli": "~10.0.3", | |||
| "@angular/compiler-cli": "~10.0.4", | |||
| "@types/node": "^12.11.1", | |||
| "@graphql-codegen/cli": "1.17.0", | |||
| "@types/jasmine": "~3.5.0", | |||
| "@types/jasminewd2": "~2.0.3", | |||
| "@types/node": "^12.11.1", | |||
| "codelyzer": "^6.0.0", | |||
| "jasmine-core": "~3.5.0", | |||
| "jasmine-spec-reporter": "~5.0.0", | |||
| @@ -44,6 +51,10 @@ | |||
| "protractor": "~7.0.0", | |||
| "ts-node": "~8.3.0", | |||
| "tslint": "~6.1.0", | |||
| "typescript": "~3.9.5" | |||
| "typescript": "~3.9.5", | |||
| "@graphql-codegen/typescript": "1.17.0", | |||
| "@graphql-codegen/typescript-operations": "1.17.0", | |||
| "@graphql-codegen/typescript-apollo-angular": "1.17.0", | |||
| "@graphql-codegen/introspection": "1.17.0" | |||
| } | |||
| } | |||
| @@ -12,10 +12,10 @@ import { MatListModule } from '@angular/material/list'; | |||
| import { MatMenuModule } from '@angular/material/menu'; | |||
| import { MatSelectModule } from '@angular/material/select'; | |||
| import { MatSidenavModule } from '@angular/material/sidenav'; | |||
| import { MatSnackBarModule } from '@angular/material/snack-bar'; | |||
| import { MatTableModule } from '@angular/material/table'; | |||
| import { MatTabsModule } from '@angular/material/tabs'; | |||
| import { MatToolbarModule } from '@angular/material/toolbar'; | |||
| import { MatSnackBarModule } from '@angular/material/snack-bar'; | |||
| import { BrowserModule } from '@angular/platform-browser'; | |||
| import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | |||
| import { AppComponent } from './app.component'; | |||
| @@ -24,7 +24,6 @@ import { PizzaListComponent } from './pizza-list/pizza-list.component'; | |||
| import { ToppingCreateComponent } from './topping-create/topping-create.component'; | |||
| @NgModule({ | |||
| declarations: [ | |||
| AppComponent, | |||
| @@ -53,7 +52,7 @@ import { ToppingCreateComponent } from './topping-create/topping-create.componen | |||
| ReactiveFormsModule, | |||
| BrowserModule, | |||
| HttpClientModule, | |||
| BrowserAnimationsModule | |||
| BrowserAnimationsModule, | |||
| ], | |||
| 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 {} | |||