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: src/pages/learn/index.mdx
+8-10Lines changed: 8 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ import { Callout } from "nextra/components"
6
6
7
7
GraphQL is a query language for your API, and a server-side runtime for executing queries using a type system you define for your data. The [GraphQL specification](https://spec.graphql.org/) was open-sourced in 2015 and has since been implemented in a variety of programming languages. GraphQL isn't tied to any specific database or storage engine—it is backed by your existing code and data.
8
8
9
+
<Callouttype="info">If you're already familiar with GraphQL and would like to read documentation on how to build a GraphQL service, then there are libraries to help you implement GraphQL in [many different languages](/community/tools-and-libraries/?tags=server). There are also many libraries available that allow [client applications to query existing GraphQL APIs](/community/tools-and-libraries/?tags=client).</Callout>
10
+
9
11
## Describe your API with a type system
10
12
11
13
A GraphQL service is created by [defining types and their fields](/learn/schema/), and then writing a function for each field to [provide the required data](/learn/execution/). For example, a GraphQL service that tells you the name of a logged-in user might look like this:
@@ -23,16 +25,14 @@ type User {
23
25
Alongwithfunctionsforeachfieldoneachtype:
24
26
25
27
```js
26
-
Query: {
27
-
me(obj, args, context, info) {
28
-
returncontext.request.auth.user
29
-
}
28
+
// Providedataforthe `me` fieldonthe `Query` type
29
+
functionQuery_me(obj, args, context, info) {
30
+
returncontext.request.auth.user
30
31
}
31
32
32
-
User: {
33
-
name(obj, args, context, info) {
34
-
returncontext.db.getUserFullName(obj.id)
35
-
}
33
+
// Providedataforthe `name` fieldonthe `User` type
34
+
functionUser_name(obj, args, context, info) {
35
+
returncontext.db.getUserFullName(obj.id)
36
36
}
37
37
```
38
38
@@ -102,6 +102,4 @@ The examples in this guide are based on [a modified version of the SWAPI GraphQL
102
102
103
103
Now that you know some key GraphQL concepts, you're ready to learn about all of the different aspects of its [type system](/schema/).
104
104
105
-
If you're already familiar with GraphQL and would like to read documentation on how to build a GraphQL service, then there are libraries to help you implement GraphQL in [many different languages](/community/tools-and-libraries/?tags=server). There are also many libraries available that allow [client applications to query existing GraphQL APIs](/community/tools-and-libraries/?tags=client).
106
-
107
105
For an in-depth learning experience with practical tutorials, see [the available training courses](/community/resources/training-courses).
0 commit comments