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" |
"build": "ng build", | "build": "ng build", | ||||
"test": "ng test", | "test": "ng test", | ||||
"lint": "ng lint", | "lint": "ng lint", | ||||
"e2e": "ng e2e" | |||||
"e2e": "ng e2e", | |||||
"generate": "graphql-codegen --config codegen.yml" | |||||
}, | }, | ||||
"private": true, | "private": true, | ||||
"dependencies": { | "dependencies": { | ||||
"@angular/platform-browser-dynamic": "~10.0.4", | "@angular/platform-browser-dynamic": "~10.0.4", | ||||
"@angular/router": "~10.0.4", | "@angular/router": "~10.0.4", | ||||
"apollo-angular": "^1.10.0", | "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", | "tslib": "^2.0.0", | ||||
"zone.js": "~0.10.3" | "zone.js": "~0.10.3" | ||||
}, | }, | ||||
"@angular-devkit/build-angular": "~0.1000.3", | "@angular-devkit/build-angular": "~0.1000.3", | ||||
"@angular/cli": "~10.0.3", | "@angular/cli": "~10.0.3", | ||||
"@angular/compiler-cli": "~10.0.4", | "@angular/compiler-cli": "~10.0.4", | ||||
"@types/node": "^12.11.1", | |||||
"@graphql-codegen/cli": "1.17.0", | |||||
"@types/jasmine": "~3.5.0", | "@types/jasmine": "~3.5.0", | ||||
"@types/jasminewd2": "~2.0.3", | "@types/jasminewd2": "~2.0.3", | ||||
"@types/node": "^12.11.1", | |||||
"codelyzer": "^6.0.0", | "codelyzer": "^6.0.0", | ||||
"jasmine-core": "~3.5.0", | "jasmine-core": "~3.5.0", | ||||
"jasmine-spec-reporter": "~5.0.0", | "jasmine-spec-reporter": "~5.0.0", | ||||
"protractor": "~7.0.0", | "protractor": "~7.0.0", | ||||
"ts-node": "~8.3.0", | "ts-node": "~8.3.0", | ||||
"tslint": "~6.1.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" | |||||
} | } | ||||
} | } |
import { MatMenuModule } from '@angular/material/menu'; | import { MatMenuModule } from '@angular/material/menu'; | ||||
import { MatSelectModule } from '@angular/material/select'; | import { MatSelectModule } from '@angular/material/select'; | ||||
import { MatSidenavModule } from '@angular/material/sidenav'; | import { MatSidenavModule } from '@angular/material/sidenav'; | ||||
import { MatSnackBarModule } from '@angular/material/snack-bar'; | |||||
import { MatTableModule } from '@angular/material/table'; | import { MatTableModule } from '@angular/material/table'; | ||||
import { MatTabsModule } from '@angular/material/tabs'; | import { MatTabsModule } from '@angular/material/tabs'; | ||||
import { MatToolbarModule } from '@angular/material/toolbar'; | import { MatToolbarModule } from '@angular/material/toolbar'; | ||||
import { MatSnackBarModule } from '@angular/material/snack-bar'; | |||||
import { BrowserModule } from '@angular/platform-browser'; | import { BrowserModule } from '@angular/platform-browser'; | ||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||||
import { AppComponent } from './app.component'; | import { AppComponent } from './app.component'; | ||||
import { ToppingCreateComponent } from './topping-create/topping-create.component'; | import { ToppingCreateComponent } from './topping-create/topping-create.component'; | ||||
@NgModule({ | @NgModule({ | ||||
declarations: [ | declarations: [ | ||||
AppComponent, | AppComponent, | ||||
ReactiveFormsModule, | ReactiveFormsModule, | ||||
BrowserModule, | BrowserModule, | ||||
HttpClientModule, | HttpClientModule, | ||||
BrowserAnimationsModule | |||||
BrowserAnimationsModule, | |||||
], | ], | ||||
providers: [], | providers: [], | ||||
bootstrap: [AppComponent] | bootstrap: [AppComponent] |
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 {} |