undefinedfix
Sign in

App home page has multiple content areas, divided into multiple interfaces, multiple requests or one-time return?

edemaine edited in Sat, 28 May 2022

In making a news app, there are columns at the top of the home page, top news and ordinary news below. There are separate interfaces behind the three. At present, it is divided into three requests, but it seems that some other people's practices are to return the data of a page at one time. How do you do it?

6 Replies
vqx46
commented on Sat, 28 May 2022

Single principle. Most of the time, the list involves paging or refreshing. If you use a swarm to return a single page of partial data, it will involve all overloading.

Of course, one-time loading is also beneficial. Sometimes, if the network fails, one-time loading will load all resources in place. If the network is abnormal, all resources will fail to load, that is consistency.

From the perspective of testability, it is more recommended to be single.

M_Salehi
commented on Sat, 28 May 2022

There is always a trade-off between flexibility and simplicity

unknown
commented on Sat, 28 May 2022

Maybe it's back-end rendering. I suggest that this kind of content can be separately requested. As long as the interface speed is not too slow, there should be no problem

RBA
commented on Sun, 29 May 2022

According to the concept of back-end micro service, it should be separated, which can be realized through node.js To aggregate interfaces

user3518753
commented on Sun, 29 May 2022

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

SlumberSuite
commented on Sun, 29 May 2022

The consumption of the server is about the same, but not for the client. It is recommended that a request be returned after the back end is assembled;

lock This question has been locked and the reply function has been disabled.