GraphQL 对没有前端客户端的系统有用吗?

Could GraphQL be useful for a system without a frontend client?

到目前为止,我看过的所有指南都涉及通过 Graphql 与前端客户端通信,我想知道它是否对纯后端有任何用途,例如微服务之间的通信?

您当然也可以从另一台服务器向 API 发出请求。正如您可以从任何地方调用任何 REST 端点一样,您也可以使用 GraphQL APIs 执行服务器到服务器的通信。

例如,在 Scaphold, we use Lambda for many webhooks and scheduled tasks. And from our microservice, we use the request library 向 Scaphold 服务器的 GraphQL API 发出 POST 请求。

Here's an example of a create mutation that you can use from a Node server.

希望对您有所帮助!