How does js implement batch http requests, that is, several http requests that are merged into one request?

as shown in the figure, store.findRecord ("r1mp3). Then (res = > {}) , store.findRecord (" r2jewelry 5). Then (res = > {}) , record3.save (). Then (res = > {}) ; All three will send http requests, but will be merged into one request, only one request, others say you can use the timer event loop to achieve, I have no idea, ask God for advice, give ideas.

Mar.09,2021

batch can be supported with axios, such as

 axios.all([
     axios.get('/api/xxxx'),
     axios.get('/api/yyyy')
   ])
   .then(axios.spread(function (xxx, yyy) {
   }))

you cannot merge requests unless you have an API that can do three things at once.
can only merge three requests into one Promise, waiting for all of them to be processed together.

Promise.all(
    store.findRecord('r1',3),
    store.findRecord('r2',5),
    record3.save()
).then((res1, res2, res3)=>{})
Menu