1.10.3. fejezet, Promise

Kapcsolódó hivatkozások

import fs = require('fs/promises');
 
let pr1 = fetch("https://www.primefaces.org/data/customers", requestOptions);
let pr2 = fs.readFile('generated.json', { encoding: 'utf8' });
 
Promise.all([pr1, pr2]).then((responses) => {
    responses[0].json().then(data => console.log(data, 'balance:', JSON.parse(responses[1])[0].balance));
}).catch(err => console.log(err));

Using async await with a foreach loop (StackOverflow)