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
{{ message }}
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/docs/glossary/graphql.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,22 +3,22 @@ title: GraphQL
3
3
disableTableOfContents: true
4
4
---
5
5
6
-
## What is GraphQL?
6
+
## GraphQL とは?
7
7
8
-
GraphQL is a query language for requesting information from an [API](/docs/glossary#api), and a protocol for servers that support it. GraphQL is one of the ways that you can import data into your Gatsby components.
Facebook created GraphQL in 2012 when it realized that it needed an API capable of supporting both web-based and native mobile applications. Facebook released GraphQL with an open source license in 2015.
More traditional APIs use a separate endpoint for each piece or type of data you'd like to request. For example, a newspaper API might contain:
12
+
従来の API では、リクエストするデータごとに個別のエンドポイントを使用します。たとえば、新聞の API には次のものが含まれます。
13
13
14
-
-an`/articles/<id>`endpoint that returns a specific news story;
15
-
-a`/reporters/<id>`endpoint that returns information about a particular reporter.
14
+
-特定のニュース記事を返す`/articles/<id>`エンドポイント。
15
+
-特定のレポーターに関する情報を返す`/reporters/<id>`エンドポイント。
16
16
17
-
A single news article page might require two separate network requests: one to retrieve the story data, and another for the reporter's contact details. What's more, the `/reporters`endpoint may return more data than you want to display; it might return their biography and social media accounts, when their name, email, and photo are all that you need for the page.
A GraphQL API, on the other hand, has a single endpoint. To retrieve data, you send one request string that uses a GraphQL-specific syntax. GraphQL executes the functions necessary to retrieve the data that you've requested, and returns a single JSON response.
19
+
一方、GraphQL API は単一のエンドポイントを持ちます。データを取得するには、GraphQL 固有の構文を用いて 1 つのリクエストを送信します。GraphQL は、要求したデータを取得するために必要な関数を実行し、単一の JSON 応答を返します。
20
20
21
-
A request for an article and its reporter might look like the example that follows.
21
+
特定の記事とレポーターを取得するためのリクエストは、次の例のようになります。
22
22
23
23
```graphql
24
24
{
@@ -34,7 +34,7 @@ A request for an article and its reporter might look like the example that follo
34
34
}
35
35
```
36
36
37
-
And its response contains only what you've requested.
37
+
そして、そのレスポンスには、リクエストしたプロパティのみが含まれます。
38
38
39
39
```json
40
40
{
@@ -52,18 +52,18 @@ And its response contains only what you've requested.
52
52
}
53
53
```
54
54
55
-
You do not have to use GraphQL with Gatsby, however GraphQL offers a few advantages over other methods of importing data.
-You can retrieve only the data that you need for a view.
58
-
-You can add new data types and capabilities without needing to create a new endpoint.
59
-
-You can store content in whatever way makes sense for your site, whether that's in a database, a third-party headless CMS, or Markdown-formatted text files.
0 commit comments