Skip to content

Commit 208f605

Browse files
committed
restored intro, restored order for 'how it works' section
1 parent 4fbe814 commit 208f605

File tree

1 file changed

+39
-34
lines changed

1 file changed

+39
-34
lines changed

modules/ROOT/pages/index.adoc

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,14 @@
55

66
The Neo4j GraphQL Library is a highly flexible, low-code, open source JavaScript library that enables rapid API development for cross-platform and mobile applications by tapping into the power of connected data.
77

8-
== How it works
9-
10-
Here is an example of how you can query existing data:
118

12-
[source, graphql, indent=0]
13-
----
14-
query {
15-
products {
16-
productName
17-
category {
18-
categoryName
19-
}
20-
}
21-
}
22-
----
9+
== How it works
2310

24-
The response looks like this:
11+
The Neo4j GraphQL Library requires a set of type definitions that describes the shape of your graph data and creates an API layer to communicate with the data.
2512

26-
[source, json, indent=0]
27-
----
28-
{
29-
"data": {
30-
"products": [
31-
{
32-
"productName": "New Product",
33-
"category": [
34-
{
35-
"categoryName": "New Category"
36-
}
37-
]
38-
}
39-
]
40-
}
41-
}
42-
----
13+
It generates an entire executable schema with all additional types needed to execute queries and mutations to interact with your Neo4j database.
4314

44-
For the example query to work, the library requires the following type definitions:
15+
For example, consider these type definitions:
4516

4617
[source, graphql, indent=0]
4718
----
@@ -58,7 +29,7 @@ type Category @node {
5829

5930
Based on these type definitions, the library generates query and mutation templates to create new instances of the types as well as query existing instances.
6031

61-
The following mutation creates the new product and the new category which were queried above:
32+
The following mutation creates a new product as well as a new category:
6233

6334
[source, graphql, indent=0]
6435
----
@@ -81,6 +52,40 @@ mutation {
8152
}
8253
----
8354

55+
Here is an example of how you can query existing data:
56+
57+
[source, graphql, indent=0]
58+
----
59+
query {
60+
products {
61+
productName
62+
category {
63+
categoryName
64+
}
65+
}
66+
}
67+
----
68+
69+
The response looks like this:
70+
71+
[source, json, indent=0]
72+
----
73+
{
74+
"data": {
75+
"products": [
76+
{
77+
"productName": "New Product",
78+
"category": [
79+
{
80+
"categoryName": "New Category"
81+
}
82+
]
83+
}
84+
]
85+
}
86+
}
87+
----
88+
8489
For every query and mutation that is executed against this generated schema, the Neo4j GraphQL Library generates a single Cypher query which is executed against the database.
8590
This eliminates the https://www.google.com/search?q=graphql+n%2B1[N+1 Problem], which can make GraphQL implementations slow and inefficient.
8691

0 commit comments

Comments
 (0)