GraphQL代理适用于.NET。

huangapple go评论56阅读模式
英文:

GraphQL proxy for .NET

问题

我想要能够拥有一个GraphQL API(.NET),它可以接受任何请求,然后将其转发到另一个GraphQL API。是否可以以某种简单的方式来实现这个目标?这样做的原因是,第一个API将向被转发到另一个API的请求添加一些额外的标头。

有人有什么想法吗?

谢谢!

英文:

I want to be able to have a GraphQL API (.NET) that will accept any request and then forward it to another GraphQL API. Is it possible to do this in some simple manner? Reason for it is that the first API will be adding some additional headers to the request that is being forwarded to the other API.

Anyone has any ideas ?

Thanks !

答案1

得分: 2

Hot Chocolate正在开发一个融合功能,它将把不同的GQL APIs拼接成一个单一的API。文档可以在这里找到:https://chillicream.com/docs/hotchocolate/v13/distributed-schema

然而,如果你只是寻找一个.NET反向代理,可以考虑使用YARP:https://microsoft.github.io/reverse-proxy/

英文:

Hot Chocolate is working on a fusion feature where it will stitch together disparate GQL APIs into a single one. The docs can be found here: https://chillicream.com/docs/hotchocolate/v13/distributed-schema

However, if you are just looking for a .NET reverse proxy, consider YARP: https://microsoft.github.io/reverse-proxy/

答案2

得分: 0

您的第一个API是否需要处理GraphQL请求体?如果不需要的话,简单的REST API控制器对您来说应该就足够了。您可以创建一个名为graphql的POST方法,然后在其中发送请求到第二个API。GraphQL请求体应该被处理为字符串,因为它只是用于传输。方法的核心逻辑将是丰富HTTP标头。

英文:

Does your first API need to process graphql body? If not it sounds like simple REST API controller will be just fine for you. So you can create post-method named graphql and send request to second API inside of it. Graphql body should be manipulated as string because of transfer-only purpose. And core-logic of method will be enrichment of http-headers

huangapple
  • 本文由 发表于 2023年5月11日 08:16:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76223343.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定