I would like to execute multiple http requests in my Node.js app. I also want to wait until all of them have completed before proceeding to use the results. Is Javascript Promises the way this should be done or is there something more specific to Node that handles this better?
Promise.all waits for all fulfillments (or the first rejection). You can go through below link for different ways to achieve this using Promise.allSettled().
Already been asked: Wait until all promises complete even if some rejected
or https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled
https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Promise/all
Promises.all() seems to be what you are looking for
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.