Created
March 25, 2020 14:46
-
-
Save deckarts/b9f6070ccb11fbfa9defa3ecfbef52cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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