You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/getting-started-with-spring-boot.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,14 @@ date = 2019-01-23
7
7
toc = "true"
8
8
+++
9
9
10
-
This is a tutorial for people who never development a GraphQL server with Java. Some Spring Boot and Java knowledge is required. While we give a brief introduction into GraphQL, the focus of this tutorial is on developing a GraphQL server in Java.
10
+
This is a tutorial for people who have never development a GraphQL server with Java. Some Spring Boot and Java knowledge is required. While we give a brief introduction into GraphQL, the focus of this tutorial is on developing a GraphQL server in Java.
11
11
12
12
13
13
# GraphQL in 3 minutes
14
14
15
15
GraphQL is a query language to retrieve data from a server. It is an alternative to REST, SOAP or gRPC in some way.
16
16
17
-
For example, we wanna query the details for specific book from a online store backend.
17
+
Let's suppose we want to query the details for a specific book from a online store backend.
18
18
19
19
With GraphQL you send the following query to server to get the details for the book with the id "123":
20
20
@@ -80,7 +80,7 @@ type Author {
80
80
81
81
This tutorial will focus on how to implement a GraphQL server with exactly this schema in Java.
82
82
83
-
We barely touched GraphQL. Further information can be found on the official page: https://graphql.github.io/learn/
83
+
We've barely scratched the surface of what's possible with GraphQL. Further information can be found on the official page: https://graphql.github.io/learn/
84
84
85
85
# GraphQL Java Overview
86
86
@@ -166,7 +166,7 @@ It also defines the type `Book` which has the fields: `id`, `name`, `pageCount`
166
166
167
167
> The Domain Specific Language shown above which is used to describe a schema is called Schema Definition Language or SDL. More details about it can be found [here](https://graphql.org/learn/schema/).
168
168
169
-
But so far it is just a normal text. We need to "bring it to live" by reading the file and parsing it.
169
+
But so far this is just normal text. We need to "bring it to live" by reading the file and parsing it.
170
170
171
171
We create a new `GraphQLProvider` class in the package `com.graphqljava.tutorial.bookdetails` with an `init` method which will create a `GraphQL` instance:
172
172
@@ -197,7 +197,7 @@ public class GraphQLProvider {
197
197
{{< / highlight >}}
198
198
<p/>
199
199
200
-
We use Guava to read the file at runtime from our classpath, then create a `GraphQLSchema` and `GraphQL` instance. This `GraphQL` instance is exposed as Spring Bean. The GraphQL Java Spring adapter will use that `GraphQL` instance to make our schema available via HTTP on the default url `/graphql`.
200
+
We use Guava to read the file at runtime from our classpath, then create a `GraphQLSchema` and `GraphQL` instance. This `GraphQL` instance is exposed as a Spring Bean. The GraphQL Java Spring adapter will use that `GraphQL` instance to make our schema available via HTTP on the default url `/graphql`.
201
201
202
202
What we still need to do is to implement the `buildSchema` method which creates the `GraphQLSchema` instance:
203
203
@@ -338,7 +338,7 @@ This is an important concept to understand: the `DataFetcher` for each field in
338
338
We then use the previously fetched book to get the `authorId` and look for that specific author in the same way we look for a specific book.
339
339
340
340
# Try out the API
341
-
This is all that is needed to actually build a working GraphQL API. After the starting the Spring Boot application the API is available on `http://localhost:8080/graphql`.
341
+
This is all you actually need to build a working GraphQL API. After the starting the Spring Boot application the API is available on `http://localhost:8080/graphql`.
342
342
343
343
The easiest way to try out and explore a GraphQL API is to use a tool like [GraphQL Playground](https://github.com/prisma/graphql-playground). Download it and run it.
0 commit comments