Hey, if I wanted to expose one microservice’s API ...
# http4k
m
Hey, if I wanted to expose one microservice’s API as a client to another service, has anyone got any good examples?
d
Not quite sure what you mean here TBH. Can you elaborate a touch?
m
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
TBH I've kind of walked back from this idea since because of the coupling aspect of it.
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
Ah interesting, what do you do instead to avoid the coupling?
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)?