D
D
darksladen2017-10-23 02:22:18
JavaScript
darksladen, 2017-10-23 02:22:18

What is the best way to make single page requests to an application?

Tell me how spa requests data from the server? Let's say I have a todo list .. Also, the page displays various other information, for example, the total number of tasks, the number of remote tasks, a slider, news, in general, a lot of all sorts of things .. How to get this stuff? Make separate requests for each entity, or it is better to request everything at once.
+ I recently watched a video where a dude said that now, like, modern applications receive data from the server 1 time during download, and then they manipulate them themselves and do what they want. He showed the app with more than 100 thousand songs, different albums and it takes 2 seconds to load. Does anyone use this approach?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Ptolemy_master, 2017-10-23
@darksladen

In general, take all the data you want to show on load and insert it into the page on initial load. Then upload other data via the API as needed.
For example, in the example you indicated, I'm sure there is no download of all one hundred thousand data, and no one will watch so much at once. They upload a certain amount, well, let's say 30, and then not the songs themselves, but only their titles + some additional information. When you click on the title, the song itself is already loaded. And you can also make it so that the songs are downloaded as you listen, but then, however, there will be increased traffic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question