Replies: 1 comment
-
@ardatan any idea on this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
This is my use case:
I had a custom resolver that uses mesh SDK to combine two services in a new resolver. So I can call this custom resolver
findUserGroups
and inside this resolver implementation, I'm using two SDK functions tofindUser
based on email and get the id for the user and I want to pass this id as a request header to the second API call. The second one is another SDK function calledfindGroup
each SDK functions belongs to different sources and different GraphQL subgraphs. Something like this:It was working but after a while, I realized that I need more and more custom logic and additional resolvers in my mesh project and it started to make my mesh project more complicated and hard to maintain as I have more than 20 custom resolvers now. On the other hand, I already have a Nest.js project that contains many services and modules and helper functions that I can reuse for writing my additional resolvers but I realized that I have to somehow duplicate many of those codes inside the mesh project and additional resolvers to write my new additional resolvers.
My question is:
Most of my additional resolvers are like the above sample. Mixing some data sources input or outputs and returning some values and I highly use the SDK version of Mesh through the
context
parameter in the resolvers.So as a first step of improvement:
I started to move my Mesh project inside my Nest.js project to make it easier to reuse those existing codes in my additional resolvers. I follow up on that in another question here: #5594
But then I realized that it's not an easy task to do as I couldn't find some information or docs about Mesh + Nest.js integration.
Now as a second solution, I'm thinking about moving my custom logic and additional resolvers to a separate Nest.js project as a new subgraph and implementing them with Mesh SDK, and then adding them to the Mesh as a new data source rather than passing them with
additionalResolvers
config in meshrc file. In this way, I don't need to integrate the Mesh and my Nest.js project directly but I can link them as a new data source. I can keep my Mesh project clean and easier to maintain and I can use the default fast HTTP handler of Mesh as @ardatan described in this question: #5593But I'm not sure about the pros and cons of this approach. Do you have any idea about this approach?

I don't want to mix my setup and make that complex in the wrong way I just want to reuse existing codes inside my Nest.js project in my additional resolvers in the Mesh. This is what I mean:
Beta Was this translation helpful? Give feedback.
All reactions