How to do parallel async multiple requests at once with Promises in Node

后端 未结 4 822
Happy的楠姐
Happy的楠姐 2021-01-13 15:44

Array and loops through but I want to be able to run all of them in parallel instead as I don\'t want to run one after another.

I basically want to store all endpoin

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-13 16:12

    I use q Promise Maybe help

    return q.all([function or value1, function or value 2, ......])
    .spread(function (result1, result2, ....) {
       // do somethine
    })
    

    ............

提交回复
热议问题