Skip to content

Commit b1423ce

Browse files
smyrickdariuszkuc
andcommitted
Update spring server overview page (ExpediaGroup#539)
* Update spring server overview page Add some images and more details, copying information from https://medium.com/expedia-group-tech/creating-a-reactive-graphql-server-with-spring-boot-and-kotlin-54aca7316470 * Add dropping of spring webmvc * Update docs/spring-server/spring-overview.md Co-Authored-By: Dariusz Kuc <[email protected]> Co-authored-by: Dariusz Kuc <[email protected]>
1 parent 9a9f6f7 commit b1423ce

10 files changed

+71
-35
lines changed

docs/assets/spring-initializer.png

113 KB
Loading

docs/blogs-and-videos.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ Here are some links to other blog posts and videos which may provide further exa
88
### From the Expedia Group team
99

1010
#### graphql-kotlin
11+
Articles and videos specifically about `graphql-kotlin`
12+
1113
* 📝 [graphql-kotlin: Generate a GraphQL schema from Kotlin code](https://medium.com/expedia-group-tech/graphql-kotlin-generate-a-graphql-schema-from-kotlin-code-21d1dc2f6e27)
1214
* 📝 [Release of graphql-kotlin 1.0.0!](https://medium.com/expedia-group-tech/release-of-graphql-kotlin-1-0-0-791ad85d3116)
1315
* 📝 [Creating GraphQL Schemas in Kotlin](https://medium.com/expedia-group-tech/creating-graphql-schemas-in-kotlin-aaaac0ab0672)
14-
* 📝[Apollo Federation in a GraphQL Kotlin Server](https://medium.com/expedia-group-tech/apollo-federation-in-a-graphql-kotlin-server-115cea51607a)
15-
* 📝[Creating a Reactive GraphQL Server with Spring Boot and Kotlin](https://medium.com/expedia-group-tech/creating-a-reactive-graphql-server-with-spring-boot-and-kotlin-54aca7316470)
16+
* 📝 [Apollo Federation in a GraphQL Kotlin Server](https://medium.com/expedia-group-tech/apollo-federation-in-a-graphql-kotlin-server-115cea51607a)
17+
* 📝 [Creating a Reactive GraphQL Server with Spring Boot and Kotlin](https://medium.com/expedia-group-tech/creating-a-reactive-graphql-server-with-spring-boot-and-kotlin-54aca7316470)
18+
* 📺 [Bootiful GraphQL with Kotlin (Dariusz Kuc, Guillaume Scheibel)](https://www.youtube.com/watch?v=7YJyPXjLdug&amp;index=25) (en)
1619

1720
#### GraphQL
21+
Articles and videos about how Expedia Group is using GraphQL
22+
1823
* 📺 [Creating a federated schema for a global company (Shane Myrick)](https://youtu.be/MuD3TAP0D9Y) (en)
1924
* 📺 [Migrer ses APIs vers GraphQL: pourquoi? comment! (Guillaume Scheibel)](https://youtu.be/IRIkpvJo95s) (fr)
2025
* 📺 [Migrate your APIs to GraphQL: how? and why! (Guillaume Scheibel)](https://youtu.be/IkPMpzQ-TRI) (en)
2126
* 📺 [Transforming customer experiences and your organization with GraphQL (Jim Gust, Dan Boerner)](https://youtu.be/Jt-ZD4zj4Ow) (en)
22-
* 📺 [Bootiful GraphQL with Kotlin (Dariusz Kuc, Guillaume Scheibel)](https://www.youtube.com/watch?v=7YJyPXjLdug&amp;index=25) (en)

docs/examples.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
---
2-
id: examples
3-
title: Examples
4-
---
5-
6-
## Spring Example
7-
8-
One way to run a GraphQL server is with [Spring Boot](https://github.com/spring-projects/spring-boot). A sample Spring
9-
Boot app that uses [Spring
10-
Webflux](https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html) together with
11-
`graphql-kotlin-schema-generator` and [graphql-playground](https://github.com/prisma/graphql-playground) is provided as
12-
a [examples/spring](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/spring). All the examples used
13-
in this documentation should be available in the sample app.
14-
15-
In order to run it you can run
16-
[Application.kt](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/examples/spring/src/main/kotlin/com/expediagroup/graphql/examples/Application.kt)
17-
directly from your IDE. Alternatively you can also use the Spring Boot maven plugin by running `mvn spring-boot:run`
18-
from the command line. Once the app has started you can explore the example schema by opening Playground endpoint at
19-
[http://localhost:8080/playground](http://localhost:8080/playground).
20-
21-
## Federation Example
22-
23-
There is also an example of [Apollo Federation](https://www.apollographql.com/docs/apollo-server/federation/introduction/) with two Spring Boot apps using `graphql-kotlin-federation` and an Apollo Gateway app in Nodejs that exposes a single federated schema in [examples/federation](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/federation)
24-
project. Please refer to the README files for details on how to run each application.
1+
---
2+
id: examples
3+
title: Examples
4+
---
5+
6+
## Spring Server Example
7+
8+
One way to run a GraphQL server is with [Spring Boot](https://github.com/spring-projects/spring-boot). A sample Spring
9+
Boot app that uses [Spring
10+
Webflux](https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html) together with
11+
`graphql-kotlin-schema-generator` and [graphql-playground](https://github.com/prisma/graphql-playground) is provided as
12+
a [examples/spring](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/spring). All the examples used
13+
in this documentation should be available in the sample app.
14+
15+
In order to run it you can run
16+
[Application.kt](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/examples/spring/src/main/kotlin/com/expediagroup/graphql/examples/Application.kt)
17+
directly from your IDE. Alternatively you can also use the Spring Boot maven plugin by running `mvn spring-boot:run`
18+
from the command line. Once the app has started you can explore the example schema by opening Playground endpoint at
19+
[http://localhost:8080/playground](http://localhost:8080/playground).
20+
21+
## Federation Example
22+
23+
There is also an example of [Apollo Federation](https://www.apollographql.com/docs/apollo-server/federation/introduction/) with two Spring Boot apps using `graphql-kotlin-federation` and an Apollo Gateway app in Nodejs that exposes a single federated schema in [examples/federation](https://github.com/ExpediaGroup/graphql-kotlin/tree/master/examples/federation)
24+
project. Please refer to the README files for details on how to run each application.

docs/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
id: getting-started
2+
id: getting-started
33
title: Getting Started
44
---
55

@@ -79,7 +79,7 @@ The `GraphQLSchema` generated can be used to expose a GraphQL API endpoint.
7979
This function accepts four arguments: `config`, `queries`, `mutations` and `subscriptions`. The `queries`, `mutations`
8080
and `subscriptions` are a list of `TopLevelObject`s and will be used to generate corresponding GraphQL root types. See
8181
below on why we use this wrapper class. The `config` contains all the extra information you need to pass, including
82-
custom hooks, supported packages, and name overrides. See the full documentation: [Spring Server Overview](server/spring-overview).
82+
custom hooks, supported packages, and name overrides. See the full documentation: [Spring Server Overview](spring-server/spring-overview).
8383

8484
You can see the definition for `toSchema` [in the
8585
source](https://github.com/ExpediaGroup/graphql-kotlin/blob/master/graphql-kotlin-schema-generator/src/main/kotlin/com/expediagroup/graphql/toSchema.kt)
File renamed without changes.

docs/server/spring-overview.md renamed to docs/spring-server/spring-overview.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,36 @@ title: Spring Server Overview
77
is a Spring Boot auto-configuration library that automatically configures beans required to start up a reactive GraphQL
88
web server.
99

10+
This library is built on a [Spring WebFlux (reactive)](https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html) stack which is a non-blocking alternative to a traditional [Spring Web MVC (servlet)](https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html) based stack. Since both frameworks utilize different threading models they cannot and should not be intermixed. When building a GraphQL server using `graphql-kotlin-spring-server` all your queries and mutations should follow one of the supported [asynchronous execution models](https://expediagroup.github.io/graphql-kotlin/docs/execution/async-models).
11+
12+
## Setup
13+
14+
### Creating a Spring Server
15+
16+
The simplest way to create a new Kotlin Spring Boot app is by generating one using [Spring Initializr.](https://start.spring.io/)
17+
18+
![Image of https://start.spring.io/](assets/spring-initializer.png)
19+
20+
Once you get the sample application setup locally, you will need to add `graphql-kotlin-spring-server` dependency:
21+
22+
With Maven:
23+
24+
```xml
25+
<dependency>
26+
<groupId>com.expediagroup</groupId>
27+
<artifactId>graphql-kotlin-spring-server</artifactId>
28+
<version>${latestVersion}</version>
29+
</dependency>
30+
```
31+
32+
With Gradle:
33+
34+
```groovy
35+
compile(group: 'com.expediagroup', name: 'graphql-kotlin-spring-server', version: "$latestVersion")
36+
```
37+
38+
### Configuration
39+
1040
At a minimum, in order for `graphql-kotlin-spring-server` to automatically configure your GraphQL web server you need to
1141
specify a list of supported packages that can be scanned for exposing your schema objects through reflections.
1242

@@ -18,7 +48,7 @@ graphql:
1848
- "com.your.package"
1949
```
2050
21-
51+
### Writing Schema Code
2252
In order to expose your queries, mutations and/or subscriptions in the GraphQL schema you simply need to implement
2353
corresponding marker interface and they will be automatically picked up by `graphql-kotlin-spring-server`
2454
auto-configuration library.
@@ -69,6 +99,8 @@ type Widget {
6999
}
70100
```
71101

102+
### Default Routes
103+
72104
Your newly created GraphQL server starts up with following preconfigured default routes:
73105

74106
* **/graphql** - GraphQL server endpoint used for processing queries and mutations
File renamed without changes.

website/sidebars.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@
5151
"federated/type-resolution"
5252
],
5353
"Spring Server": [
54-
"server/spring-overview",
55-
"server/spring-beans",
56-
"server/spring-properties",
57-
"server/spring-graphql-context",
58-
"server/subscriptions"
54+
"spring-server/spring-overview",
55+
"spring-server/spring-beans",
56+
"spring-server/spring-properties",
57+
"spring-server/spring-graphql-context",
58+
"spring-server/subscriptions"
5959
],
6060
"Contributors": [
6161
"contributors/release-proc"

0 commit comments

Comments
 (0)