[英]REST API for UI - One General Endpoint vs Endpoint per Component
Let's assume we have two micro-services: companies API and accounts API.假设我们有两个微服务:公司 API 和账户 API。
We also have a dashboard that displays some data and visualizations about accounts.我们还有一个仪表板,显示有关帐户的一些数据和可视化。
The dashboard includes three widgets (for simplification):仪表板包括三个小部件(为简化起见):
Widget 1 - A table of accounts filtered by some criteria, for example, shows only pending accounts.小部件 1 - 按某些条件过滤的帐户表,例如,仅显示待处理帐户。 It also displays a few columns related to the account's company properties.它还显示与帐户的公司属性相关的几列。
Widget 2 - A piechart that displays a breakdown of accounts by one of the account's properties.小部件 2 - 按帐户属性之一显示帐户细分的饼图。
Widget 3 - Another chart that shows a breakdown of the accounts by a company.小部件 3 - 另一个显示公司帐户明细的图表。
Theoretically, all of the widgets in the dashboard display data about the same entity - accounts.从理论上讲,仪表板中的所有小部件都显示有关同一实体 - 帐户的数据。
Now, I would like to ask about two approaches for fetching and displaying the accounts in the UI:现在,我想问一下在 UI 中获取和显示帐户的两种方法:
The general REST endpoint approach通用 REST 端点方法
The REST endpoint per widget approach REST 端点每个小部件方法
My questions are:我的问题是:
Here are my ideas around this:以下是我对此的想法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.