Answers for "fetch multiple urls javascript"

0

fetch multiple urls javascript

async function getAllUrls(urls) {
    try {
        var data = await Promise.all(
            urls.map(
                url =>
                    fetch(url).then(
                        (response) => response.json()
                    )));

        return (data)

    } catch (error) {
        console.log(error)

        throw (error)
    }
}
Posted by: Guest on June-06-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language