JavaScript: Promise.all
A short, tested JavaScript example for promise.all. Copy it and adjust the names and paths for your project.
JavaScript
const [users, posts] = await Promise.all([
fetch("/api/users").then(r => r.json()),
fetch("/api/posts").then(r => r.json()),
]);
// Promise.allSettled never rejects:
const results = await Promise.allSettled([a(), b()]);Find it in Zest
Search for “javascript promise.all” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.