Last active
March 23, 2020 15:40
-
-
Save deckarts/2222781ff64386f677dd0ba625db363e to your computer and use it in GitHub Desktop.
This file contains 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
// Requires a Node environment | |
// Plus Axios https://github.com/axios/axios | |
'use strict' | |
const axios = require('axios'); | |
// Get request json response data from source | |
function getUS() { return axios.get('https://covidtracking.com/api/us'); } | |
axios.all([getUS()]) | |
.then(axios.spread(function (usa) { | |
console.log( | |
'\nUnited States' | |
+ '\nTested: ' + usa['data'][0]['posNeg'] | |
+ '\nPositive: ' + usa['data'][0]['positive'] | |
+ '\nNegative: ' + usa['data'][0]['negative'] | |
+ '\nHospitalized: ' + usa['data'][0]['hospitalized'] | |
+ '\nDeaths: ' + usa['data'][0]['death']); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment