const getDataFromApi = async (pathParam) => {
return fetch(`https://demo2202897.mockable.io/${pathParam}`).then(res => res.json());
};
//
const getAllData = async () => {
const promises = [];
promises.push(getDataFromApi("qotd"));
promises.push(getDataFromApi("getLargeData"));
try {
const result = await Promise.all(promises);
document.write(JSON.stringify(result, null, 2));
} catch(e) {
console.error(e);
}
}
getAllData();
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.