Skip to content

Commit 9f24bb9

Browse files
get and combine data file
1 parent a91db1f commit 9f24bb9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

helpers/combined-data.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const get_data = require('../helpers/fetch-data');
2+
3+
const casesUrl = 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv'
4+
const recoveredUrl = 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv';
5+
const deathsUrl = 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv';
6+
7+
8+
let get_combine_data = () => {
9+
return Promise.all([get_data(casesUrl), get_data(recoveredUrl), get_data(deathsUrl)])
10+
.then(result => {
11+
//combine the data
12+
13+
// return combined data
14+
return result
15+
})
16+
.catch(error => [{
17+
"message": "unable to load the data",
18+
'error': error
19+
}])
20+
}
21+
22+
module.exports = get_combine_data;

0 commit comments

Comments
 (0)