Skip to content

Commit 3da3d33

Browse files
ydfzgyjjonirrings
authored andcommitted
up to date 20180702 (xitu#91)
1 parent e6fe960 commit 3da3d33

26 files changed

+221
-84
lines changed

site/CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

site/code/index.html.js

Lines changed: 73 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ GraphQL 已有多种编程语言支持。下表包含一些流行的服务端框
4242
4343
- [graphql-dotnet](https://github.com/graphql-dotnet/graphql-dotnet):.NET 的 GraphQL 实现
4444
- [graphql-net](https://github.com/ckimes89/graphql-net):转换 GraphQL 到 IQueryable
45+
- [Hot Chocolate](https://github.com/ChilliCream/hotchocolate):针对 .net core 和 .net classic 的 GraphQL 服务
4546
4647
### Clojure
4748
@@ -111,17 +112,19 @@ $ curl -XPOST "http://0:3000" -H'Content-Type: application/json' -d'{
111112
### Elixir
112113
113114
- [absinthe](https://github.com/absinthe-graphql/absinthe):Elixir 的 GraphQL 实现。
114-
- [graphql-elixir](https://github.com/graphql-elixir/graphql): 一个 Facebook GraphQL 的 Elixir 实现。
115+
- [graphql-elixir](https://github.com/graphql-elixir/graphql)一个 Facebook GraphQL 的 Elixir 实现。
115116
116117
### Erlang
117118
118119
- [graphql-erlang](https://github.com/shopgun/graphql-erlang):Erlang 的 GraphQL 实现。
119120
120121
### Go
121122
122-
- [graphql-go](https://github.com/graphql-go/graphql): 一个 Go/Golang 的 GraphQL 实现。
123-
- [graphql-relay-go](https://github.com/graphql-go/relay): 一个用于帮助构建 graphql-go 服务器的 Go/Golang 库,支持 react-relay 。
123+
- [graphql-go](https://github.com/graphql-go/graphql)一个 Go/Golang 的 GraphQL 实现。
124+
- [graphql-relay-go](https://github.com/graphql-go/relay)一个用于帮助构建 graphql-go 服务器的 Go/Golang 库,支持 react-relay 。
124125
- [neelance/graphql-go](https://github.com/neelance/graphql-go):一个活跃的 Golang GraphQL 实现。
126+
- [machinebox/graphql](https://github.com/machinebox/graphql):用于 GraphQL 的一个优雅的底层 HTTP 客户端。
127+
- [samsarahq/thunder](https://github.com/samsarahq/thunder):可轻松进行 schema 构建、实时查询和批处理的 GraphQL 实现。
125128
126129
### Groovy
127130
@@ -135,7 +138,7 @@ $ curl -XPOST "http://0:3000" -H'Content-Type: application/json' -d'{
135138
- 在启动时使用 spring bean 配置生成 schema,以便于扩展。
136139
- 包含一个在开发环境下默认启用的 [GraphiQL](https://github.com/graphql/graphiql) 浏览器。这一浏览器可以在 /graphql/browser 下访问。
137140
- 使用 Grails 提供的数据绑定覆盖默认的数据绑定
138-
- 提供一个 [特质](https://grails.github.io/gorm-graphql/latest/api/org/grails/gorm/graphql/plugin/testing/GraphQLSpec.html) 以使您更容易对 GraphQL 入口端点进行集成测试
141+
- 提供一个 [特质](https://grails.github.io/gorm-graphql/latest/api/org/grails/gorm/graphql/plugin/testing/GraphQLSpec.html) 以使你更容易对 GraphQL 入口端点进行集成测试
139142
140143
更多信息请查看 [文档](https://grails.github.io/gorm-graphql/latest/guide/index.html)。
141144
@@ -302,6 +305,47 @@ Apollo Server 也支持所有的 Node.js HTTP 服务器框架:Express、Connec
302305
- [graphql-php](https://github.com/webonyx/graphql-php):GraphQL 参考实现的 PHP 移植版本。
303306
- [graphql-relay-php](https://github.com/ivome/graphql-relay-php):一个用于辅助构建 graphql-php 服务器的库,支持 react-relay。
304307
308+
#### [Siler](https://siler.leocavalcante.com/graphql/) ([github](https://github.com/leocavalcante/siler))
309+
310+
Siler 是一个具有高级抽象功能,可与 GraphQL 搭配使用的 PHP 库。
311+
312+
如果要运行 Siler 的 hello world 脚本:
313+
314+
\`\`\`graphql
315+
type Query {
316+
hello: String
317+
}
318+
\`\`\`
319+
320+
\`\`\`php
321+
<?php
322+
declare(strict_types=1);
323+
require_once '/path/to/vendor/autoload.php';
324+
325+
use Siler\Diactoros;
326+
use Siler\Graphql;
327+
use Siler\Http;
328+
329+
$typeDefs = file_get_contents(__DIR__.'/schema.graphql');
330+
$resolvers = [
331+
'Query' => [
332+
'hello' => 'world',
333+
],
334+
];
335+
$schema = Graphql\schema($typeDefs, $resolvers);
336+
337+
echo "Server running at http://127.0.0.1:8080\\n";
338+
Http\server(Graphql\psr7($schema), function (\Throwable $err) {
339+
var_dump($err);
340+
return Diactoros\json([
341+
'error' => true,
342+
'message' => $err->getMessage(),
343+
]);
344+
})()->run();
345+
\`\`\`
346+
347+
它还根据 Apollo 的工作原理提供了构建 WebSocket 订阅服务器的功能。
348+
305349
### Python
306350
307351
#### [Graphene](http://graphene-python.org/) ([github](https://github.com/graphql-python/graphene))
@@ -320,14 +364,14 @@ pip install graphene
320364
import graphene
321365
322366
class Query(graphene.ObjectType):
323-
hello = graphene.String()
367+
hello = graphene.String(name=graphene.String(default_value="World"))
324368
325-
def resolve_hello(self, args, context, info):
326-
return 'Hello world!'
369+
def resolve_hello(self, info, name):
370+
return 'Hello ' + name
327371
328372
schema = graphene.Schema(query=Query)
329373
result = schema.execute('{ hello }')
330-
print(result.data['hello'])
374+
print(result.data['hello']) # "Hello World"
331375
\`\`\`
332376
333377
其也有对 [Relay](https://facebook.github.io/relay/)、Django、SQLAlchemy 和 Google App Engine 的良好绑定。
@@ -361,7 +405,7 @@ Schema = GraphQL::Schema.define do
361405
query QueryType
362406
end
363407
364-
puts Schema.execute('{ hello }')
408+
puts Schema.execute('{ hello }').to_json
365409
\`\`\`
366410
367411
其也有对于 Relay 和 Rails 的良好绑定。
@@ -391,6 +435,7 @@ Executor.execute(schema, query) map println
391435
## GraphQL 客户端
392436
393437
- [C# / .NET](#c-net-1)
438+
- [Clojurescript](#clojurescript-1)
394439
- [Go](#go-1)
395440
- [Java / Android](#java-android)
396441
- [JavaScript](#javascript-1)
@@ -399,15 +444,22 @@ Executor.execute(schema, query) map println
399444
400445
### C# / .NET
401446
447+
- [GraphQL.Client](https://github.com/graphql-dotnet/graphql-client):一个用于 .NET 的 GraphQL 客户端。
402448
- [graphql-net-client](https://github.com/bkniffler/graphql-net-client):基于 .Net 的 GraphQL 客户端基本样例。
449+
- [SAHB.GraphQLClient](https://github.com/sahb1239/SAHB.GraphQLClient):GraphQL 客户端,支持从 C# 的类生成查询。
450+
451+
### Clojurescript
452+
453+
- [re-graph](https://github.com/oliyh/re-graph/):一个在 Clojurescript 中实现的 GraphQL 客户端,支持 websockets。
403454
404455
### Go
405456
406-
- [graphql](https://github.com/shurcooL/graphql#readme): 一个使用 Go 编写的 GraphQL 客户端实现。
457+
- [graphql](https://github.com/shurcooL/graphql#readme)一个使用 Go 编写的 GraphQL 客户端实现。
407458
408459
### Java / Android
409460
410461
- [Apollo Android](https://github.com/apollographql/apollo-android):一个用于 Android 的 GraphQL 客户端,强类型、带缓存功能,使用 Java 编写。
462+
- [Nodes](https://github.com/americanexpress/nodes):一个 GraphQL JVM 客户端,用于从标准模型定义构建查询。
411463
412464
### JavaScript
413465
@@ -416,6 +468,8 @@ Executor.execute(schema, query) map println
416468
- [graphql-request](https://github.com/graphcool/graphql-request):一个简单的弹性的 JavaScript GraphQL 客户端,可以运行于所有的 JavaScript 环境(浏览器,Node.js 和 React Native)—— 基本上是 \`fetch\` 的轻度封装。
417469
- [Lokka](https://github.com/kadirahq/lokka):一个简单的 JavaScript GraphQL 客户端,可以运行于所有的 JavaScript 环境 —— 浏览器,Node.js 和 React Native。
418470
- [nanogql](https://github.com/yoshuawuyts/nanogql):一个使用模板字符串的小型 GraphQL 客户端库。
471+
- [gq-loader](https://github.com/Houfeng/gq-loader):一个简单的 JavaScript GraphQL 客户端,通过 webpack 加载器让 *.gql 文件作为模块使用。
472+
- [AWS Amplify](https://aws.github.io/aws-amplify):使用云服务进行应用开发的 JavaScript 库,支持 GraphQL 后端和用于处理 GraphQL 数据的 React 组件。
419473
420474
### Swift / Objective-C iOS
421475
@@ -425,22 +479,26 @@ Executor.execute(schema, query) map println
425479
### Python
426480
427481
- [GQL](https://github.com/graphql-python/gql):一个 Python 中的 GraphQL 客户端。
428-
482+
- [python-graphql-client](https://github.com/graphcool/python-graphql-client):适用于 Python 2.7+ 的简单 GraphQL 客户端。
483+
- [sgqlc](https://github.com/profusion/sgqlc):一个简单的 Python GraphQL 客户端。支持为 GraphQL schema 中定义的类型生成代码。
484+
429485
## 工具
430486
431487
- [graphiql](https://github.com/graphql/graphiql) ([npm](https://www.npmjs.com/package/graphiql)):一个交互式的运行于浏览器中的 GraphQL IDE.
432488
- [libgraphqlparser](https://github.com/graphql/libgraphqlparser):一个 C++ 版 GraphQL 查询语言分析器,提供 C 和 C++ API。
433489
- [Graphql Language Service](https://github.com/graphql/graphql-language-service):一个用于构建 IDE 的 GraphQL 语言服务(诊断、自动完成等)的接口。
490+
- [quicktype](https://quicktype.io) ([github](https://github.com/quicktype/quicktype)):在 TypeScript、Swift、golang、C#、C++ 等语言中为 GraphQL 查询生成类型。
434491
435492
## 服务
436493
437494
- [Apollo Engine](http://www.apollographql.com/engine/):一个用于监视 GraphQL 后端的性能和使用的服务。
438-
- [GraphCMS](https://graphcms.com/):一个 BaaS(后端即服务),它为您配置了一个作为内容编辑工具来处理存储数据的 GraphQL 后端。
439-
- [Graphcool](https://www.graph.cool) ([github](https://github.com/graphcool)):一个 BaaS(后端即服务),它为您的应用程序提供了一个 GraphQL 后端,且具有用于管理数据库和存储数据的强大的 web ui。
495+
- [GraphCMS](https://graphcms.com/):一个 BaaS(后端即服务),它为你配置了一个作为内容编辑工具来处理存储数据的 GraphQL 后端。
496+
- [Graphcool](https://www.graph.cool) ([github](https://github.com/graphcool)):一个 BaaS(后端即服务),它为你的应用程序提供了一个 GraphQL 后端,且具有用于管理数据库和存储数据的强大的 web ui。
440497
- [Reindex](https://www.reindex.io/baas/) ([github](https://github.com/reindexio/reindex-js)):一个 BaaS(后端即服务),它针对使用 React 和 Relay 的应用程序配置了 GraphQL 后端。
441-
- [Scaphold](https://scaphold.io) ([github](https://github.com/scaphold-io)):一个 BaaS(后端即服务),为您的应用程序配置了一个拥有多种不同集成的 GraphQL 后端。
442-
- [Tipe](https://tipe.io) ([github](https://github.com/tipeio)):一个 SaaS(软件即服务)内容管理系统,允许您使用强大的编辑工具创建您的内容,并通过 GraphQL 或 REST API 从任何地方访问它。
498+
- [Scaphold](https://scaphold.io) ([github](https://github.com/scaphold-io)):一个 BaaS(后端即服务),为你的应用程序配置了一个拥有多种不同集成的 GraphQL 后端。
499+
- [Tipe](https://tipe.io) ([github](https://github.com/tipeio)):一个 SaaS(软件即服务)内容管理系统,允许你使用强大的编辑工具创建你的内容,并通过 GraphQL 或 REST API 从任何地方访问它。
443500
- [AWS AppSync](https://aws.amazon.com/appsync/):完全托管的 GraphQL 服务,包含实时订阅、离线编程和同步、企业级安全特性以及细粒度的授权控制。
501+
- [Hasura](https://hasura.io):一个 BaaS(后端即服务),允许你在 Postgres 上创建数据表、定义权限并使用 GraphQL 接口查询和操作。
444502
445503
## 更多内容
446504

site/community/Community-Events.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ sublinks: 即将举行的活动,聚会
1616

1717
GraphQL Europe 是欧洲非营利性的 GraphQL 大会,邀请了来自世界各地的演讲嘉宾。了解来自行业专家的 GraphQL 最佳实践,并成为蓬勃发展的 GraphQL 社区的一部分。
1818

19+
### GraphQL Finland 会议
20+
21+
- **日期:** 2018 年 10 月 18 - 19 日
22+
- **地点:** 芬兰 赫尔辛基
23+
- **链接:** https://graphql-finland.fi/
24+
25+
GraphQL Finland 是一个社区组织的 GraphQL 会议。这是首次在芬兰举办这样的活动,该活动由一天的研讨会和一天的专题演讲组成。GraphQL Finland 由 React Finland 的团队组织。
26+
1927
## 聚会
2028

2129
### 北美洲
@@ -27,7 +35,6 @@ GraphQL Europe 是欧洲非营利性的 GraphQL 大会,邀请了来自世界
2735
- [GraphQL NYC](https://www.meetup.com/GraphQL-NYC/)
2836
- [GraphQL Atlanta](https://www.meetup.com/GraphQL-Atlanta/)
2937
- [GraphQL Austin](https://www.meetup.com/ATX-GraphQL/)
30-
- [GraphQL Miami](https://www.meetup.com/Miami-GraphQL/)
3138
- [GraphQL Los Angeles](https://www.meetup.com/Los-Angeles-GraphQL-Meetup/)
3239
- [GraphQL Dallas-Fort Worth](https://www.meetup.com/DFW-GraphQL-Meetup/)
3340
- [GraphQL Ottawa](https://www.meetup.com/GraphQL-Ottawa/)
@@ -46,7 +53,6 @@ GraphQL Europe 是欧洲非营利性的 GraphQL 大会,邀请了来自世界
4653

4754
- [GraphQL Amsterdam](https://www.meetup.com/Amsterdam-GraphQL-Meetup/)
4855
- [GraphQL Berlin](https://www.meetup.com/graphql-berlin/)
49-
- [GraphQL Istanbul](https://www.meetup.com/GraphQL-Istanbul/)
5056
- [GraphQL London](https://www.meetup.com/GraphQL-London)
5157
- [GraphQL Paris](https://www.meetup.com/GraphQL-Paris/)
5258
- [GraphQL Munich](https://www.meetup.com/GraphQL-Munich/)
@@ -59,7 +65,7 @@ GraphQL Europe 是欧洲非营利性的 GraphQL 大会,邀请了来自世界
5965
### 澳洲
6066

6167
- [GraphQL Melbourne](http://graphql.melbourne/)
62-
- [GraphQL Sydney](http://graphql.sydney/)
68+
- [GraphQL Sydney](https://graphql.sydney/)
6369

6470
### 亚洲
6571

site/community/Community-Resources.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sublinks: 博客,视频
1313

1414
## Facebook Group
1515

16-
加入 [GraphQL Facebook Group](https://www.facebook.com/groups/graphql.community/) 来提出问题、讨论和分享。GraphQL Facebook group 是首选的发布公告和进行广泛讨论的场所。
16+
加入 [GraphQL Facebook Group](https://www.facebook.com/groups/graphql.community/) 分享和发现新内容。GraphQL Facebook group 是首选的发布公告和进行广泛讨论的场所。
1717

1818
## Twitter
1919

@@ -55,7 +55,7 @@ sublinks: 博客,视频
5555
- [从 REST 到 GraphQL](https://0x2a.sh/from-rest-to-graphql-b4e95e94c26b#.tag7nzkrb) - Jacob Gillespie
5656
- [GraphQL 讲解](https://medium.com/apollo-stack/graphql-explained-5844742f195e#.zdykxos6i) - Jonas Helfer
5757
- [GraphQL 概念可视化](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.hfczgtdsj) - Dhaivat Pandya
58-
- [构建 f8 App:使用 GraphQL & Relay](http://makeitopen.com/tutorials/building-the-f8-app/relay/)
58+
- [构建 f8 App:使用 GraphQL & Relay](http://makeitopen.com/docs/en/1-A2-relay.html)
5959
- [你的第一个 GraphQL 服务器](https://medium.com/the-graphqlhub/your-first-graphql-server-3c766ab4f0a2#.ovn0y19k4) - Clay Allsopp
6060
- [教程:用 Apollo-server、Dataloader 和 Knex 启动一个 JS API](https://bamtech.gitbooks.io/dev-standards/content/backend/graphql-js/getting-started-with-apollo-server-dataloader-knex.mo.html) - Thomas Pucci
6161
- [教程:如何构建一个 GraphQL 服务器](https://medium.com/apollo-stack/tutorial-building-a-graphql-server-cddaa023c035#.bu6sdnst4) - Jonas Helfer
@@ -92,9 +92,15 @@ Facebook 内外的开发者在世界各地的会议和聚会上都谈到了 Grap
9292
- [使用 Angular 2 释放 GraphQL 的力量](https://www.youtube.com/watch?v=VYpJ9pfugM8) - Gerard Sans, NG-BE 2016
9393
- [网络研讨会系列:GraphQL 在世界各地](https://graphql-world.com/webinar) - Vince Ning & Michael Paris
9494
- [GraphQL Europe 中的所有演讲](https://www.youtube.com/playlist?list=PLn2e1F9Rfr6n_WFm9fPE-_wYPrYvSTySt) - Lee Byron, Sashko Stubailo, Dan Schafer, Johannes Schickling 等
95+
- [学习基于 React 和 Relay 的 GraphQL](https://www.packtpub.com/application-development/learning-graphql-react-and-relay-video) - Divyendu Singh
96+
- [实践比 RESTful Web 服务更好的 GraphQL(视频)](https://www.packtpub.com/application-development/hands-graphql-better-restful-web-services-video) - Ashwin Hegde
9597

9698
## 图书
9799

100+
- [GraphQL 指南](https://graphql.guide) - John Resig 和 Loren Sands-Ramshaw
101+
- [学习 GraphQL](https://www.amazon.com/Learning-GraphQL-Declarative-Fetching-Modern/dp/1492030716/) - Eve Porcello 和 Alex Banks
102+
- [全栈 GraphQL](https://www.graphql.college/fullstack-graphql) - Julian Mayorga
103+
- [在 Elixir 和 Absinthe 中使用 Craft GraphQL API](https://pragprog.com/book/wwgraphql/craft-graphql-apis-in-elixir-with-absinthe) - Bruce Williams and Ben Wilson
98104
- [学习 GraphQL 和 Relay](https://www.packtpub.com/web-development/learning-graphql-and-relay) - Samer Buna
99105

100106
## 更多资源

site/graphql-js/APIReference-Errors.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ class GraphQLError extends Error {
5454
nodes?: Array<any>,
5555
stack?: ?string,
5656
source?: Source,
57-
positions?: Array<number>
57+
positions?: Array<number>,
58+
originalError?: ?Error,
59+
extensions?: ?{ [key: string]: mixed }
5860
)
5961
}
6062
```

site/graphql-js/APIReference-Execution.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export function execute(
3737
contextValue?: mixed,
3838
variableValues?: ?{[key: string]: mixed},
3939
operationName?: ?string
40-
): Promise<ExecutionResult>
40+
): MaybePromise<ExecutionResult>
41+
42+
type MaybePromise<T> = Promise<T> | T;
4143

4244
type ExecutionResult = {
4345
data: ?Object;

site/graphql-js/APIReference-TypeSystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ var RGBType = new GraphQLEnumType({
442442
443443
```js
444444
class GraphQLInputObjectType {
445-
constructor(config: GraphQLInputObjectTypeConfig)
445+
constructor(config: GraphQLInputObjectConfig)
446446
}
447447

448448
type GraphQLInputObjectConfig = {

site/graphql-js/Tutorial-GraphQLClients.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,21 @@ http://localhost:4000/graphql
2323
{"data":{"hello":"Hello world!"}}
2424
```
2525

26+
如果你更倾向于使用图形用户界面发送测试查询,你可以使用客户端,例如 [GraphiQL](https://github.com/graphql/graphiql)[Insomnia](https://github.com/getinsomnia/insomnia)
27+
2628
通过浏览器发送 GraphQL 也很简单。打开 http://localhost:4000 ,开启开发者控制台,粘贴:
2729

2830
```javascript
29-
var xhr = new XMLHttpRequest();
30-
xhr.responseType = 'json';
31-
xhr.open("POST", "/graphql");
32-
xhr.setRequestHeader("Content-Type", "application/json");
33-
xhr.setRequestHeader("Accept", "application/json");
34-
xhr.onload = function () {
35-
console.log('data returned:', xhr.response);
36-
}
37-
xhr.send(JSON.stringify({query: "{ hello }"}));
31+
fetch('/graphql', {
32+
method: 'POST',
33+
headers: {
34+
'Content-Type': 'application/json',
35+
'Accept': 'application/json',
36+
},
37+
body: JSON.stringify({query: "{ hello }"})
38+
})
39+
.then(r => r.json())
40+
.then(data => console.log('data returned:', data));
3841
```
3942

4043
你会在控制台中见到返回的数据:
@@ -58,21 +61,23 @@ type Query {
5861
```javascript
5962
var dice = 3;
6063
var sides = 6;
61-
var xhr = new XMLHttpRequest();
62-
xhr.responseType = 'json';
63-
xhr.open("POST", "/graphql");
64-
xhr.setRequestHeader("Content-Type", "application/json");
65-
xhr.setRequestHeader("Accept", "application/json");
66-
xhr.onload = function () {
67-
console.log('data returned:', xhr.response);
68-
}
6964
var query = `query RollDice($dice: Int!, $sides: Int) {
7065
rollDice(numDice: $dice, numSides: $sides)
7166
}`;
72-
xhr.send(JSON.stringify({
73-
query: query,
74-
variables: { dice: dice, sides: sides },
75-
}));
67+
68+
fetch('/graphql', {
69+
method: 'POST',
70+
headers: {
71+
'Content-Type': 'application/json',
72+
'Accept': 'application/json',
73+
},
74+
body: JSON.stringify({
75+
query,
76+
variables: { dice, sides },
77+
})
78+
})
79+
.then(r => r.json())
80+
.then(data => console.log('data returned:', data));
7681
```
7782

7883
这种语法的变量有助于自动避免转义 bug,也更容易监控服务器。

0 commit comments

Comments
 (0)