🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# Introduction GraphQL 是一种应用程序层查询语言,可以用于任何数据库。它也是开源的(MIT许可证),由 Facebook 创建。它与REST 的主要区别在于 GraphQL 不使用端点,而是使用查询(GraphQL does not use endpoints, but queries instead),并且大多数服务器语言都支持它,比如 JavaScript (Node.js)、Go、Ruby、PHP、Java和Python。 We'll now look at the main differences between GraphQL and REST. GraphQL: - The queries are readable - You can evolve the API without versions - Type system - You can avoid doing multiple round trips to fetch related data - It's easy to limit the set of data we need REST: - In REST, everything is a resource - REST is schemaless - You need versions to evolve the API - It's hard to limit the set of data we need - If you need data from different resources, you need to make multiple requests