Skip to content

docs: cleanup fed example docs #1629

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

Merged
merged 1 commit into from
Jan 9, 2023
Merged
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
81 changes: 0 additions & 81 deletions examples/federation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,84 +46,3 @@ query ExampleQuery {
}
}
```








is two Spring applications `base-app` and `extend-app` that use `graphql-kotlin-federation` to generate the schema.
These apps run on different ports (`8080`, `8081`) so they can run simultaneously.

The `gateway` is a Node.js app running Apollo Gateway on port `4000` and connects to the two Spring apps.
You can make queries against the Spring apps directly or run combined queries from the gateway.

## Running Locally


### Spring Apps
Build the Spring applications by running the following commands in the `/federation` directory

```shell script
./gradlew clean build
```

> NOTE: in order to ensure you use the right version of Gradle we highly recommend to use the provided wrapper scripts

Start the servers:

* Run each `Application.kt` directly from your IDE
* Alternatively you can also use the spring boot plugin from the command line.

```shell script
./gradlew bootRun
```


Once the app has started you can explore the example schema by opening the Playground endpoint
* `base-app` http://localhost:8080/playground
* `extend-app` http://localhost:8081/playground

### Gateway

See the instructions in the gateway [README](./gateway/README.md)



1. Start `products-subgraph` by running the Spring Boot app from the IDE or by running `./gradlew bootRun` from `products-subgraph` project
2. Start `reviews-subgraph` by running the Spring Boot app from the IDE or `./gradlew bootRun` from `reviews-subgraph` project
3. Start Federated Router
1. Install [rover CLI](https://www.apollographql.com/docs/rover/getting-started)
2. Start router and compose products schema using [rover dev command](https://www.apollographql.com/docs/rover/commands/dev)

```shell
# start up router and compose products schema
rover dev --name products --schema ./products-subgraph/src/main/resources/graphql/schema.graphqls --url http://localhost:8080/graphql
```

3. In **another** shell run `rover dev` to compose reviews schema

```shell
rover dev --name reviews --schema ./reviews-subgraph/src/main/resources/graphql/schema.graphqls --url http://localhost:8080/graphql
```

4. Open http://localhost:3000 for the query editor

Example federated query

```graphql
query ExampleQuery {
products {
id
name
description
reviews {
id
text
starRating
}
}
}
```