ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 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