0

Consider

--GraphQl--> App(Typescript/ NodeJS) --Graphql--> DbWrapper(Typescript/ NodeJs) --Prisma--> MariaDb

We Have 2 NodeJs servers which should have graphql endpoints, is there any way how to just pass graphql request from first server (App) to second (DbWrapper)?

  • I think we're going to need more information to give a helpful answer to that, please. Obviously you could write a service, or even just a bit of code on one of the servers, that would take the original request, make a request to one server, get the response, and make another request to a second server. That would seem to be the answer based on the little information you've given. – Rich N Apr 08 '22 at 09:06
  • I'm looking for some way to just take the first request on app and pass it to another server let's say through graphql-request.... Like if you use express rest api.... you have localhost:3000/someApi with something in body, you can easily pass this to another server let's say on localhost:3001/anotherApi with the same body – Martin Hoang Apr 08 '22 at 09:08
  • This depends if yo want to hide the other server, if not you can just proxy the request. https://stackoverflow.com/questions/30800829/node-forward-path-request-to-another-server but this will be visible in the network tab. If you want to hide then you can use axios or fetch and just copy over the request (graphql req is just a post call with query field where you stringify the requested fields, check you network tab in chrome to see how that looks in reality) – Luke Celitan Apr 08 '22 at 10:28

0 Answers0