Axios looping promisses and update previous axios response data
Axios looping promisses and update previous axios response data How I can wait for all promises to be resolve in order to update the response.data of the first ajax call? (example using swapi.co api) A simple express .get wrapper. Each /starship list the pilots resource (see comment inside). I want to have full pilots data in my wrapper /api/starships. app.get('/api/starships/', function(req, res){ axios.get('https://swapi.co/api/starships') .then(function(response){ // res.setHeader('Cache-Control', 'no-control'); // pilots: [ // "https://swapi.co/api/people/13/", // "https://swapi.co/api/people/14/", // "https://swapi.co/api/people/25/", // "https://swapi.co/api/people/31/" // ], response.data.results.forEach(function(starship, i){ if (starship.pilots) { var promises = ; var fullpillots = ; starship.pilots.forEach(function(pilot_inf...