学习教程
最佳实践

GraphQL 最佳实践

¥GraphQL Best Practices

GraphQL 规范有意对 API 面临的一些重要问题保持沉默,例如处理网络、授权和分页。这并不意味着使用 GraphQL 时这些问题没有解决方案,只是它们超出了 GraphQL 的描述范围,而只是常见做法。

¥The GraphQL specification is intentionally silent on a handful of important issues facing APIs such as dealing with the network, authorization, and pagination. This doesn’t mean that there aren’t solutions for these issues when using GraphQL, just that they’re outside the description about what GraphQL is and instead just common practice.

本节中的文章不应被视为福音,在某些情况下可能会理所当然地被忽略,而转而采用其他方法。一些文章介绍了 Facebook 内部围绕设计和部署 GraphQL 服务开发的一些理念,而另一些文章则是解决常见问题(例如通过 HTTP 提供服务和执行授权)的更具战术性的建议。

¥The articles in this section should not be taken as gospel, and in some cases may rightfully be ignored in favor of some other approach. Some articles introduce some of the philosophy developed within Facebook around designing and deploying GraphQL services, while others are more tactical suggestions for solving common problems like serving over HTTP and performing authorization.