Add links to all leagues in array that retrieves all game data
This commit is contained in:
@@ -13,7 +13,7 @@ const fetchMatchesData = async (req, res, next) => {
|
||||
const yesterday = yesterdayUnformatted.format('YYYY-MM-DD');
|
||||
|
||||
// Array of years to fetch matches data
|
||||
const years = [2002, 2003, 2021];
|
||||
const league_id = [2021, 2002, 2014, 2019, 2015, 2013];
|
||||
|
||||
// Array to store all matches data
|
||||
let allMatches = [];
|
||||
@@ -21,7 +21,7 @@ const fetchMatchesData = async (req, res, next) => {
|
||||
// Loop through each year and fetch matches data
|
||||
for (const year of years) {
|
||||
const response = await axios({
|
||||
url: `http://api.football-data.org/v4/competitions/${year}/matches`,
|
||||
url: `http://api.football-data.org/v4/competitions/${league_id}/matches`,
|
||||
method: 'GET',
|
||||
params: {
|
||||
dateFrom: yesterday, // Set dateFrom to yesterday's date
|
||||
|
||||
Reference in New Issue
Block a user