const axios = require('axios');
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000);
});
}
async function go() {
try {
const coffee = await getCoffee();
console.log(coffee);
const wes = await axios('https://api.github.com/users/wesbos');
console.log(wes.data);
const wordPromise = axios('http://www.setgetgo.com/randomword/get.php');
const userPromise = axios('https://randomuser.me/api/');
const namePromise = axios('https://uinames.com/api/');
const [word, user, name] = await Promise.all([wordPromise, userPromise, namePromise]);
console.log(word.data, user.data, name.data);
} catch (e) {
console.error(e);
}
}
go();