Hey, if I wanted to expose one microservice’s API as a client to another service, has anyone got any good examples?
d
dave
03/24/2022, 6:23 AM
Not quite sure what you mean here TBH. Can you elaborate a touch?
m
MrNiamh
03/24/2022, 1:48 PM
e.g. I’ve got service A which has end points 1, 2, and 3. I have Service B which I want to be able to call end point 1, 2, 3.
Is there a way to expose service A as a library which I can use in service B? I don’t want to have to remember to update any end point paths etc., would rather use it like a function.
I vaguely remember us doing something like that in Bo but it’s been a while and i’ve had a few too many beers since.
d
dave
03/24/2022, 5:33 PM
TBH I've kind of walked back from this idea since because of the coupling aspect of it.
dave
03/24/2022, 5:35 PM
effectively you're talking about having the following modules for each service:
/api (DTOs)
/client (relies on /api)
/service (relies on /api)
Then the dependent services can rely on the client module
m
MrNiamh
03/28/2022, 10:30 AM
Ah interesting, what do you do instead to avoid the coupling?
MrNiamh
03/28/2022, 10:32 AM
If I stick with the coupling, for the client module, is there a way to use http4k in a way so the client functions are auto generated (or at least auto-update if any end points are changed)?