在GraphQl-API顶部设置REST-API(使用Apollo网关?)
我正在开发一个 GRANDstack (GraphQL-React-Apollo-Neo4jDatabase) 项目,并被告知它现在需要一个额外的 REST-API,而不需要对现有后端和 GraphQL-API 进行巨大的更改。当然,我们必须动作要快。
我们发现了这个(Apollo Gateway):https://medium.com/tkssharma/an-api-gateway-is-a-microservice-pattern-where-a-separate-service-is-built-to-sit-in-front-of-your -be4b16861d40
我们计划使用它来设置新的 REST-API,因为我们知道我们很快也需要微服务。所以我想,这可以通过已经包含的 Apollo 以某种形式进行设置。但我还没有完全理解它。
有人有这方面的经验吗?或者有人知道一个实现这个并且可以检查的项目吗?我想要更多关于此的材料,其中包含实际代码。特别是关于设置这样一个网关以将 REST-API 放在上面。
如果有比 Apollo 网关更简单、更好的文档,请告诉我!对想法持开放态度,但不要完全矫枉过正(尽管我们不允许将 REST 直接放入后端,但它必须保持不变)。
非常感谢!
简而言之:我们当前的后端提供 GraphQL-API,效果很好。但我们的一位客户(图中为“客户”)需要 REST-API。因此,我们希望使用一个网关(?),它可能应该放置在单独的 docker 容器中的后端之前/之上,接收来自用户的 HTTP 请求,然后向 graphQL 中的后端询问所需的数据。
I am working on a GRANDstack (GraphQL-React-Apollo-Neo4jDatabase) project and got told that it now needs an additional REST-API without making huge changes to the existing backend and GraphQL-API. And of course we have to be quick about it.
We found this (Apollo Gateway): https://medium.com/tkssharma/an-api-gateway-is-a-microservice-pattern-where-a-separate-service-is-built-to-sit-in-front-of-your-be4b16861d40
We plan on using this to set that new REST-API on top because we know we will need microservices soon enough as well. So I guess, this can be set up in some form with the already included Apollo. But I have yet to fully understand it.
Does anyone have some experience with this? Or does anyone know a project that implements this and can be checked out? I'd like more material about this that contains actual code. Especially about setting up such a gateway to put a REST-API on top.
If there is something easier and better documented than this Apollo gateway, please let me know! Open to ideas, but not complete overkills (Though we are not allowed to just put REST directly into our backend, it has to stay quite untouched).
Thank you very much!
In short: Our current backend offers GraphQL-API which works just fine. But one of our customers (in this picture "client") needs a REST-API. So we hope on using a gateway (?) which should be placed before/upon our backend in a separate docker container probably, takes in HTTP-requests from the user and then asks our backend in graphQL for the needed data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果有人偶然发现了这一点,我们决定执行以下操作:
由于我们必须快速处理,因此我们将设置另一个 docker 容器,其中包含一个小型服务器,该服务器通过 REST-API 接受数据。根据收到的数据,它会在我们的后端调用特定的 GraphQL 查询/突变。简单的。无需额外的第三方软件。简单就是胜利。
祝你过得愉快!
If anyone ever stumbles upon this, we decided to do the following:
Since we have to be quick about it, we will set up another docker container, that contains a small server, which accepts data via a REST-API. Depending on the received data, it calls specific GraphQL-Queries/Mutations on our backend. Easy. No additional 3rd-party software. Simple just wins.
Have a good one!