ax1mx2
ax1mx2

Reputation: 704

Strongly typed calls to other microservices in LoopBack v4

I'm currently evaluating the suitability of LoopBack for a future microservice-based project. Moreover, I'm new to LoopBack, so please correct me, if a misunderstood the concepts of Loopback.

At times, you need an aggregator microservice which calls several others. Is it possible to generate a strongly typed client library stubs (in the form of a Service) analogous to the lb4 openapi command?

And if not, what is the point of using TypeScript (as advertized), when one has to use pure JavaScript as shown in these examples (1) (2)?

Also is there an option to use an OpenAPI spec file from existing services?

It seems to me that this is a 'terra incognita' at this point for LoopBack v4 with TypeScript.

Upvotes: 1

Views: 240

Answers (1)

Raymond Feng
Raymond Feng

Reputation: 1536

Disclaimer: I'm a maintainer of LoopBack.

There are a few things involved here:

  1. Communication between microservices - we support REST and gRPC via connectors, such as loopback-connector-openapi and loopback-connector-grpc.

  2. As you mentioned, it's on the roadmap to generate service stubs - see https://github.com/strongloop/loopback-next/issues/1070#issuecomment-403530459. The lb4 openapi command has implemented a lot of logic that can be applied to lb4 openapi-stub. Contributions are welcome!

  3. You should also check out https://github.com/strongloop/loopback4-example-shopping/pull/268.

Upvotes: 2

Related Questions