Skip to content

Commit 481963c

Browse files
author
Travis CI
committed
Auto-deploy by Travis CI
0 parents  commit 481963c

File tree

205 files changed

+362415
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+362415
-0
lines changed

.nojekyll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: get this out of the source

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
graphql.cn

_redirects

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# 200 = reverse proxy rules
2+
# https://www.netlify.com/docs/redirects/#rewrites-and-proxying
3+
4+
/swapi-graphql https://graphql.github.io/swapi-graphql/ 200
5+
/swapi-graphql/* https://graphql.github.io/swapi-graphql/:splat 200
6+
7+
# 301 = permanent redirects
8+
# https://www.netlify.com/docs/redirects/#http-status-codes
9+
10+
/docs/api-reference-errors /graphql-js/error/ 301
11+
/docs/api-reference-execution /graphql-js/exection/ 301
12+
/docs/api-reference-express-graphql /graphql-js/express-graphql/ 301
13+
/docs/api-reference-graphql /graphql-js/graphql/ 301
14+
/docs/api-reference-language /graphql-js/language/ 301
15+
/docs/api-reference-type-system /graphql-js/type/ 301
16+
/docs/api-reference-type-utilities /graphql-js/utilities/ 301
17+
/docs/api-reference-type-validation /graphql-js/validation/ 301
18+
/docs/getting-started /learn/ 301
19+
/docs/intro /learn/ 301
20+
/docs/introspection /learn/introspection/ 301
21+
/docs/queries /learn/queries/ 301
22+
/docs/typesystem /learn/schema/ 301
23+
/docs/validation /learn/validation/ 301
24+
/docs/videos /community/#videos 301
25+
/help /community/ 301
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html><html lang="zh-Hans-CN"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><title>GraphQL: A data query language | GraphQL</title><meta name="viewport" content="width=640"/><meta name="description" content="GraphQL 提供了 API 中数据的完整描述,提供让客户端能够准确地获取需要的数据而不包含任何冗余的能力,让 API 更加容易随着时间推移而演进,并提供强大的开发者工具。"/><meta property="og:title" content="GraphQL: 一种用于 API 的查询语言。"/><meta property="og:description" content="GraphQL 提供了 API 中数据的完整描述,提供让客户端能够准确地获取需要的数据而不包含任何冗余的能力,让 API 更加容易随着时间推移而演进,并提供强大的开发者工具。"/><meta property="og:type" content="website"/><meta property="og:url" content="http://graphql.cn/"/><meta property="og:image" content="/img/og_image.png"/><meta property="og:image:type" content="image/png"/><meta name="twitter:card" content="summary"/><meta name="twitter:site" content="@graphql"/><meta name="twitter:title" content="GraphQL: 一种用于 API 的查询语言。"/><meta name="twitter:description" content="GraphQL 提供让客户端能够准确地获取需要的数据而不包含任何冗余的能力,并让 API 更加容易随着时间推移而演进。"/><meta name="twitter:image" content="/img/twitter_image.png"/><link rel="shortcut icon" href="/img/favicon.png"/><link rel="home" type="application/rss+xml" href="/blog/rss.xml" title="GraphQL 团队博客"/><link rel="stylesheet" href="/style.css"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Rubik:300|Roboto:300"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,400i,600"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/></head><body><header><section><a class="nav-home" href="/"><img class="nav-logo" src="/img/logo.svg" alt="GraphQL Logo" width="30" height="30"/>GraphQL</a><nav><a href="/learn/">学习</a><a href="/code/">代码</a><a href="/community/">社区</a><a href="https://spec.graphql.cn/" target="_blank" rel="noopener noreferrer">规范</a><a href="/codeofconduct/">行为守则</a><a href="https://foundation.graphql.org/" target="_blank" rel="noopener noreferrer">基金会</a><a href="https://l.graphql.org/" target="_blank" rel="noopener noreferrer">社区总览</a><a href="https://principles.graphql.cn/" target="_blank" rel="noopener noreferrer">开发原则</a></nav><div class="algolia-search-wrapper"><input type="text" id="algolia-search-input" placeholder="搜索文档..." aria-label="搜索文档"/></div></section></header><section><div class="documentationContent"><div class="inner-content"><h1>GraphQL: A data query language</h1><p>9/14/2015 by Lee Byron</p><hr/><div><div>
2+
3+
</div><p>When we built Facebook&#x27;s mobile applications, we needed a data-fetching API powerful enough to describe all of Facebook, yet simple and easy to learn so product developers can focus on building things quickly. We developed GraphQL three years ago to fill this need. Today it powers hundreds of billions of API calls a day. This year we&#x27;ve begun the process of open-sourcing GraphQL by drafting a specification, releasing a reference implementation, and forming a community around it here at <a href="http://graphql.org/" target="_blank" rel="nofollow noopener noreferrer">graphql.org</a>.</p><h2><a class="anchor" name="why-graphql?"></a>Why GraphQL? <a class="hash-link" href="#why-graphql?">#</a></h2><p>Back in 2012, we began an effort to rebuild Facebook&#x27;s native mobile applications.</p><p>At the time, our iOS and Android apps were thin wrappers around views of our mobile website. While this brought us close to a platonic ideal of the &quot;write one, run anywhere&quot; mobile application, in practice it pushed our mobile-webview apps beyond their limits. As Facebook&#x27;s mobile apps became more complex, they suffered poor performance and frequently crashed.</p><p>As we transitioned to natively implemented models and views, we found ourselves for the first time needing an API data version of News Feed — which up until that point had only been delivered as HTML. We evaluated our options for delivering News Feed data to our mobile apps, including RESTful server resources and FQL tables (Facebook&#x27;s SQL-like API). We were frustrated with the differences between the data we wanted to use in our apps and the server queries they required. We don&#x27;t think of data in terms of resource URLs, secondary keys, or join tables; we think about it in terms of a graph of objects and the models we ultimately use in our apps like NSObjects or JSON.</p><p>There was also a considerable amount of code to write on both the server to prepare the data and on the client to parse it. This frustration inspired a few of us to start the project that ultimately became GraphQL. GraphQL was our opportunity to rethink mobile app data-fetching from the perspective of product designers and developers. It moved the focus of development to the client apps, where designers and developers spend their time and attention.</p><h2><a class="anchor" name="what-is-graphql?"></a>What is GraphQL? <a class="hash-link" href="#what-is-graphql?">#</a></h2><p>A GraphQL query is a string that is sent to a server to be interpreted and fulfilled, which then returns JSON back to the client.</p><div><div id="r101"><div class="miniGraphiQL" data-reactroot="" data-reactid="1" data-react-checksum="-1260504911"><div class="query-editor" data-reactid="2"></div><div class="result-window" data-reactid="3"></div></div></div>
4+
5+
</div><p><strong>Defines a data shape:</strong> The first thing you&#x27;ll notice is that GraphQL queries mirror their response. This makes it easy to predict the shape of the data returned from a query, as well as to write a query if you know the data your app needs. More important, this makes GraphQL really easy to learn and use. GraphQL is unapologetically driven by the data requirements of products and of the designers and developers who build them.</p><p><strong>Hierarchical:</strong> Another important aspect of GraphQL is its hierarchical nature. GraphQL naturally follows relationships between objects, where a RESTful service may require multiple round-trips (resource-intensive on mobile networks) or a complex join statement in SQL. This data hierarchy pairs well with graph-structured data stores and ultimately with the hierarchical user interfaces it&#x27;s used within.</p><p><strong>Strongly typed:</strong> Each level of a GraphQL query corresponds to a particular type, and each type describes a set of available fields. Similar to SQL, this allows GraphQL to provide descriptive error messages before executing a query. It also plays well with the strongly typed native environments of Obj-C and Java.</p><p><strong>Protocol, not storage:</strong> Each GraphQL field on the server is backed by a function - code linking to your application layer. While we were building GraphQL to support News Feed, we already had a sophisticated feed ranking and storage model, along with existing databases and business logic. GraphQL had to leverage all this existing work to be useful, and so does not dictate or provide any backing storage. Instead, GraphQL takes advantage of your existing code by exposing your application layer, not your storage layer.</p><p><strong>Introspective:</strong> A GraphQL server can be queried for the types it supports. This creates a powerful platform for tools and client software to build atop this information like code generation in statically typed languages, our application framework, Relay, or IDEs like GraphiQL (pictured below). GraphiQL helps developers learn and explore an API quickly without grepping the codebase or wrangling with cURL.</p><div><div id="r102"><div class="miniGraphiQL" data-reactroot="" data-reactid="1" data-react-checksum="-1260504911"><div class="query-editor" data-reactid="2"></div><div class="result-window" data-reactid="3"></div></div></div>
6+
7+
</div><p><strong>Version free:</strong> The shape of the returned data is determined entirely by the client&#x27;s query, so servers become simpler and easy to generalize. When you&#x27;re adding new product features, additional fields can be added to the server, leaving existing clients unaffected. When you&#x27;re sunsetting older features, the corresponding server fields can be deprecated but continue to function. This gradual, backward-compatible process removes the need for an incrementing version number. We still support three years of released Facebook applications on a single version of our GraphQL API.</p><p>With GraphQL, we were able to build full-featured native News Feed on iOS in 2012, and on Android shortly after. Since then, GraphQL has become the primary way we build our mobile apps and the servers that power them. More than three years later, GraphQL powers almost all data-fetching in our mobile applications, serving millions of requests per second from nearly 1,000 shipped application versions.</p><p>When we built GraphQL in 2012 we had no idea how important it would become to how we build things at Facebook and didn&#x27;t anticipate its value beyond Facebook. However earlier this year we announced Relay, our application framework for the web and React Native built atop GraphQL. The community excitement for Relay inspired us to revisit GraphQL to evaluate every detail, make improvements, fix inconsistencies, and write a specification describing GraphQL and how it works.</p><p>Two months ago, we <a href="https://www.youtube.com/watch?v=WQLzZf34FJ8" target="_blank" rel="nofollow noopener noreferrer">made our progress public</a> and released a working draft of the <a href="http://facebook.github.io/graphql/" target="_blank" rel="nofollow noopener noreferrer">GraphQL spec</a> and a reference implementation: <a href="https://github.com/graphql/graphql-js" target="_blank" rel="nofollow noopener noreferrer">GraphQL.js</a>. Since then, a community has started to form around GraphQL, and versions of the GraphQL runtime are being <a href="https://github.com/chentsulin/awesome-graphql" target="_blank" rel="nofollow noopener noreferrer">built in many languages</a>, including Go, Ruby, Scala, Java, .Net, and Python. We&#x27;ve also begun to share some of the tools we use internally, like <a href="https://github.com/graphql/graphiql" target="_blank" rel="nofollow noopener noreferrer">GraphiQL</a>, an in-browser IDE, documentation browser, and query runner. GraphQL has also seen production usage outside Facebook, in a project for the <a href="https://www.youtube.com/watch?v=S0s935RKKB4" target="_blank" rel="nofollow noopener noreferrer"><em>Financial Times</em></a> by consultancy <a href="http://red-badger.com/" target="_blank" rel="nofollow noopener noreferrer">Red Badger</a>.</p><p>“GraphQL makes orchestrating data fetching so much simpler and it pretty much functions as a perfect isolation point between the front end and the back end”
8+
— Viktor Charypar, software engineer at Red Badger</p><p>While GraphQL is an established part of building products at Facebook, its use beyond Facebook is just beginning. Try out <a href="http://graphql-swapi.parseapp.com/graphiql/" target="_blank" rel="nofollow noopener noreferrer">GraphiQL</a> and help provide feedback on our <a href="https://github.com/facebook/graphql/" target="_blank" rel="nofollow noopener noreferrer">specification</a>. We think GraphQL can greatly simplify data needs for both client product developers and server-side engineers, regardless of what languages you&#x27;re using in either environment, and we&#x27;re excited to continue to improve GraphQL, help a community grow around it, and see what we can build together.</p></div></div><div class="nav-docs"><div class="nav-docs-section"><h3>Subscribe</h3><a rel="home" type="application/rss+xml" href="/blog/rss.xml">RSS</a></div><div class="nav-docs-section"><h3>Recent Posts</h3><ul><li><a href="/blog/production-ready/">Leaving technical preview</a></li><li><a href="/blog/rest-api-graphql-wrapper/">Wrapping a REST API in GraphQL</a></li><li><a href="/blog/mocking-with-graphql/">Mocking your server is easy with GraphQL</a></li><li><a href="/blog/subscriptions-in-graphql-and-relay/">Subscriptions in GraphQL and Relay</a></li><li>GraphQL: A data query language</li></ul></div></div></div></section><footer><section class="sitemap"><a href="/" class="nav-home" aria-label="主页"></a><div><h5><a href="/learn/">学习</a></h5><a href="/learn/">入门</a><a href="/learn/queries/">查询语言</a><a href="/learn/schema/">类型系统</a><a href="/learn/execution/">执行</a><a href="/learn/best-practices/">最佳实践</a></div><div><h5><a href="/code">代码</a></h5><a href="/code/#server-libraries">服务端</a><a href="/code/#graphql-clients">客户端</a><a href="/code/#tools">工具</a></div><div><h5><a href="/community">社区</a></h5><a href="/community/upcoming-events/">即将到来的活动</a><a href="http://stackoverflow.com/questions/tagged/graphql" target="_blank" rel="noopener noreferrer">Stack Overflow</a><a href="https://www.facebook.com/groups/graphql.community/" target="_blank" rel="noopener noreferrer">Facebook Group</a><a href="https://twitter.com/GraphQL" target="_blank" rel="noopener noreferrer">Twitter</a></div><div><h5>更多</h5><a href="http://spec.graphql.cn/" target="_blank" rel="noopener noreferrer">GraphQL 规范</a><a href="https://foundation.graphql.org/" target="_blank" rel="noopener noreferrer">GraphQL 基金会</a><a href="https://github.com/graphql" target="_blank" rel="noopener noreferrer">GraphQL GitHub</a><a href="https://github.com/xitu/graphql.github.io/edit/zh-Hans/site/blog/20150914-graphql.md" target="_blank" rel="noopener noreferrer">编辑本页 ✎</a></div></section><section class="copyright">Copyright © 2020 GraphQL 基金会。保留所有权利。Linux 基金会已经注册了商标和使用商标。有关 Linux 基金会的商标清单,请参阅我们的 <a href="https://www.linuxfoundation.org/trademark-usage">商标使用</a> 页面。Linux 是 Linus Torvalds 的注册商标。<a href="http://www.linuxfoundation.org/privacy">隐私政策</a><a href="http://www.linuxfoundation.org/terms">使用条款</a></section></footer><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>
9+
docsearch({
10+
apiKey: 'd103541f3e6041148aade2e746ed4d61',
11+
indexName: 'graphql',
12+
inputSelector: '#algolia-search-input'
13+
});
14+
</script><script>
15+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
16+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
17+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
18+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
19+
20+
ga('create', 'UA-44373548-16', 'auto');
21+
ga('send', 'pageview');
22+
</script><script src="/vendor/react-15.0.1.min.js"></script><script src="/vendor/react-dom-15.0.1.min.js"></script><script src="index.html.057ea905ec9e570d7854.js"></script></body></html>

0 commit comments

Comments
 (0)