I
I
Ivan Vekov2021-11-07 00:39:03
Software design
Ivan Vekov, 2021-11-07 00:39:03

How to properly architecture graphQL in microservices?

Hello!

There is an application (more precisely, it is in the development process). Initially, they began to cut the interaction of microservices through rests and queues in the old fashioned way. Then I remembered that this is no longer fashionable (I'm talking about the front) and there is a rather interesting thing called graphQL.

Now only 2 services are written. The implementation has already been screwed to one through the graph (lumen + lighthouse). And then something I did not manage. For good, I want to make one common graphql service for processing requests from the front. How to do it?

I read about federations, installed Apollo ... To be honest, I didn’t understand anything. How should it work? Like there are N services, each has its own scheme and Apollo somehow has to pull them up himself? Or should all schemes be on the Apollo Server and have requests to services? What then requests - rest? It's strange somehow.
After reading it, I had an expectation that I would install Apollo and he would do everything himself. As a result, from the documentation, I got that there is a separate Apollo with its own scheme and separate services with their own schemes ....

I'm digging in the wrong steppe at all, and Apollo has nothing to do with it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2021-11-07
@vekov

You don't have to do that. Graphql is just a gateway. Using it as an interface to the database, even through business logic, is such a solution. Although you can, of course, who argues. Federation is convenient, but on a scale it's easier to shoot yourself than to do it. aplollo itself will not do anything for you - it's a framework, nothing more) well, a large community with ready-made modules

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question