jeudi 8 juillet 2021

Api design, communication between microservices

I am writing an app which simply has 3 microservices.

  1. Basket which holds basket and items
class Basket {
  Long id;
  List<Items> items;
}
class Item {
  Long id;
  String name;
  Long pricingId;
}
  1. Pricing which calculates and holds price for item
class Pricing {
  Long id;
  BigDecimal value;
}
  1. Calculation which calculates and holds sum for basket
class Calculation{
  Long id;
  BigDecimal sum;
}

For communication i use synchronous requests via REST.

What is the best way to design api between microservices.

ie. how should i fetch just Calculation with only basket id

I use vanila JS on the front side.

Aucun commentaire:

Enregistrer un commentaire