club homepage complete

This commit is contained in:
dominicjk
2024-04-15 14:14:23 -06:00
parent 411e6bf584
commit 0bd33dcd1a
6 changed files with 90 additions and 38 deletions

View File

@@ -7,7 +7,7 @@ const fetchLeagueScorerData = async (req, res, next) => {
const leagueID = req.params.leagueID;
// Make GET request to the API endpoint using the league ID
const response = await axios.get(`http://api.football-data.org/v4/competitions/${leagueID}/scorers?season&limit=20`, {
const response = await axios.get(`http://api.football-data.org/v4/teams/${teamID}/scorers?limit=5`, {
headers: {
'X-Auth-Token': '0aa1ed31245d4a36b1ef5a79150324b3', // Add your API key here
},
@@ -19,17 +19,9 @@ const fetchLeagueScorerData = async (req, res, next) => {
// Attach the data to res.locals
res.locals.topScorers = {
scorers: scorerData.scorers.map(player => ({
player: {
player_id: player.player.id,
player_name: player.player.name,
},
team: {
team_id: player.player.id,
team_name: player.team.name,
team_crest: player.team.crest,
},
games_played: player.playedMatches,
goals: player.goals,
playerID: scorer.player.id,
playerName: scorer.player.name,
goals: scorer.numberOfGoals,
}))
};