Skip to content

Fix the outstanding issues #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Our goal is to make an Angular app with a list of the past SpaceX launches along
client: {
service: {
name: 'angular-spacex-graphql-codegen',
url: 'https://api.spacex.land/graphql/'
url: 'https://spacex-production.up.railway.app/'
}
}
};
Expand Down Expand Up @@ -104,7 +104,7 @@ Our goal is to make an Angular app with a list of the past SpaceX launches along

Note the first line: `query launchDetails($id: ID!)` When we generate the Angular service the query name is turned into PascalCase and GQL is appended to the end, so the service name for the launch details would be LaunchDetailsGQL. Also in the first line we define any variables we'll need to pass into the query. Please note it's import to include id in the query return so apollo can cache the data.

1. We add [Apollo Angular](https://www.apollographql.com/docs/angular/) to our app with `ng add apollo-angular`. In `src/app/graphql.module.ts` we set our API url `const uri = 'https://api.spacex.land/graphql/';`.
1. We add [Apollo Angular](https://www.apollographql.com/docs/angular/) to our app with `ng add apollo-angular`. In `src/app/graphql.module.ts` we set our API url `const uri = 'https://spacex-production.up.railway.app/';`.

1. Install Graphql Code Generator and the needed plugins `npm i --save-dev @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-apollo-angular @graphql-codegen/typescript-operations`

Expand All @@ -113,7 +113,7 @@ Our goal is to make an Angular app with a list of the past SpaceX launches along
```yml
# Where to get schema data
schema:
- https://api.spacex.land/graphql/
- https://spacex-production.up.railway.app/
# The client side queries to turn into services
documents:
- src/**/*.graphql
Expand Down
2 changes: 1 addition & 1 deletion apollo.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
client: {
service: {
name: 'angular-spacex-graphql-codegen',
url: 'https://api.spacex.land/graphql/'
url: 'https://spacex-production.up.railway.app/'
}
}
};
2 changes: 1 addition & 1 deletion codegen.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Where to get schema data
schema:
- https://api.spacex.land/graphql/
- https://spacex-production.up.railway.app/
# The client side queries to turn into services
documents:
- src/**/*.graphql
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scripts": {
"ng": "ng",
"start": "ng serve --aot",
"start:legacy": "NODE_OPTIONS=--openssl-legacy-provider ng serve --aot",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
Expand Down
2 changes: 1 addition & 1 deletion src/app/graphql.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular';
import {HttpLinkModule, HttpLink} from 'apollo-angular-link-http';
import {InMemoryCache} from 'apollo-cache-inmemory';

const uri = 'https://api.spacex.land/graphql/'; // <-- add the URL of the GraphQL server here
const uri = 'https://spacex-production.up.railway.app/'; // <-- add the URL of the GraphQL server here
export function createApollo(httpLink: HttpLink) {
return {
link: httpLink.create({uri}),
Expand Down
Loading