Skip to content

Instantly share code, notes, and snippets.

@deckarts
Last active March 23, 2020 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deckarts/2222781ff64386f677dd0ba625db363e to your computer and use it in GitHub Desktop.
Save deckarts/2222781ff64386f677dd0ba625db363e to your computer and use it in GitHub Desktop.
// 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