Multiple requests in parallel

Executing multiple parallel requests becomes a piece of cake with async/await. Here, we can execute several asynchronous tasks at once, and use their values in different places. The complete source code can be found at multiple_parallel.ts in src:

async function executeParallelAsyncTasks() {
const [valueA, valueB, valueC] = await
Promise.all([
await axios.get('https://jsonplaceholder.typicode.com/posts/1')
await axios.get('https://jsonplaceholder.typicode.com/posts/2'),
await axios.get('https://jsonplaceholder.typicode.com/posts/3')])
console.log("first response is ", valueA.data);
console.log(" second response is ", valueB.data);
console.log("third response is ", valueC.data);
}