APP home page has multiple content areas, multiple requests through multiple APIs or an one-time return?

there are columns at the top of the APP, home page for making a news, top news and general news below, and there are separate interfaces behind all three. At present, it is divided into three requests, but look at some practices of others, it seems to be an one-time return of a page of data, how do you do it?


single principle.
most of the time lists involve paging or refreshing. If you use a swarm to return part of the data on a single page, it will involve full overloading.

of course, one-time loading also has advantages. Sometimes if a network failure loads all resources at once, all resources will be loaded in place. If there is an exception in the network, the resources will fail to load, that is, consistency.

single is more recommended from the point of view of testability.


there is always a trade-off between flexibility and simplicity


may be backend rendering
I suggest that this kind of content can be requested separately, as long as it can ensure that the speed of the interface is not particularly slow.


it should be separated according to the concept of back-end microservice. You can aggregate interfaces through middleware languages such as node.js


do you write both the interface and the front end? Do you think it is convenient to return at one time to see if it is convenient for you?


the consumption for the server is about the same, but not for the client. It is recommended that a request be assembled and returned by the back end.

Menu