Skip to content

Instantly share code, notes, and snippets.

View jferreira-godaddy's full-sized avatar
🏠
Working from home

João (Jwam) Ferreira jferreira-godaddy

🏠
Working from home
View GitHub Profile
@jferreira-godaddy
jferreira-godaddy / fetchJSON.js
Created August 21, 2017 14:44
Fetch some JSON with async function
async function fetchJson(url) {
try {
const request = await fetch(url);
const text = await request.text();
return JSON.parse(text);
}
catch (error) {
console.log(`ERROR: ${error.stack}`);
}
}