dimanche 8 juillet 2018

create endpoint to get multiple records in microservice

Currently, we have an api endpoint like this: /suppliers/{supplierNumber}, which will return a single supplier information.

But in the UI, there is a screen to display a list of suppliers for different products. So it is like this:

product1 -> supplier1
product2 -> supplier2
product3 -> supplier3

so in order to display suppliers for list of products, the code turn to be a for loop, and inside the loop, it calls the endpoint one by one.

My concern is in the performance perspective, it's not very well. And why cannot design an endpoint like:
Given a list of supplierNumber, return list of suppliers information?

Someone say it's not microservice design, i am not sure why it's not a proper design. and what's the reason behind it?

Aucun commentaire:

Enregistrer un commentaire