下記のようなAPIサーバー群があります。 ``` A: /api/aaa.json req: {} res: { id1: '1234' } B: /api/bbb.json req: {} res: { id2: '2345' } C: /api/ccc.json req: { id1 } res: { id3: '3456' } D: /api/ddd.json req: { id2, id3 } res: { answer1: 'ANSWER1' } E: /api/eee.json req: { id2, id3 } res: { answer2: 'ANSWER2' } ``` 問題 - Aに問い合わせるとCの問い合わせに必要な情報が返ってきます - Bに問い合わせるとD/Eの問い合わせに必要な情報の一部が返ってきます - Cに問い合わせるとD/Eの問い合わせに必要な情報の一部が返ってきます - BとCのレスポンスを合わせてD/Eへ問い合わせし、answer1と2を得てください 前提 - それぞれのエンドポイントは `url = { a, b, c, d, e }` として宣言済みです - レスポンスはすべてjsonです - 実行環境は後述のうち任意のものを前提としてよいです - ES2016 - TypeScript - node.js v14~ ```javascript= const main=async()=>{ const promiseB=axios.get(b); const resA = await axios.get(a).catch(e=>console.log("error a")); const promiseC=axios.get(`${c}/${resA.data.id1}`); const [resB, resC]=await Promise.all([promiseB, promiseC]).catch(e=>console.log("error b,c")); const id2=resB.data.id2; const id3=resC.data.id3 const resD=axios.get(`${d}?id2=${encodeURIComponent(id2)}&id3=${id3}`).catch(e=>console.log("error d"));; const resE=axios.get(`${e}?id2=${id2}&id3=${id3}`).catch(e=>console.log("error e")); await Promise.all([resD, resE]); const answer1=resD.data.answer1; const answer2=resE.data.answer2; } ```