Skip to content

Instantly share code, notes, and snippets.

@deckarts
Created March 25, 2020 14:46
Show Gist options
  • Save deckarts/b9f6070ccb11fbfa9defa3ecfbef52cf to your computer and use it in GitHub Desktop.
Save deckarts/b9f6070ccb11fbfa9defa3ecfbef52cf to your computer and use it in GitHub Desktop.
// needs $ npm install node-fetch
// https://github.com/node-fetch/node-fetch
const fetch = require('node-fetch');
const getCovidStats = async() => {
console.log('\nCovid-19');
try {
const response = await fetch('https://covidtracking.com/api/us');
const usa = await response.json();
console.log('United States');
console.log(usa[0]);
}
catch (err) {
console.log(`Error: ${err}`);
}
finally {
console.log('\n');
}
};
getCovidStats();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment