JarrettTo / SBAI.com-Frontend

AI Sports Betting Tool and Platform
https://sbai-com-frontend.vercel.app
4 stars 0 forks source link

Make API Call to Fetch live NBA game data #7

Closed JarrettTo closed 7 months ago

JarrettTo commented 8 months ago

In Next.js make a api folder under pages. Make sure the file name is relevant like "nba_games.ts" because Next.js will use that as the end point (e.g. localhost:3000/api/nba_games) so make it understandable. free to use any API for this, as long as the data returned by the API contains all the games for the day, such as the home and away team, the arena theyre playing in, and the schedule. Make sure you restructure the returned data in a way that fits the expected parameters or props of the GameDisplay component which is:

export type INBAGame = { id: number; homeTeam : string; homeTeamLogo : string; awayTeam : string; awayTeamLogo : string; schedule: Date;

}

ignore the logos by the way.

API Recommendations: https://data.nba.com/data/10s/v2015/json/mobile_teams/nba/2023/scores/00_todays_scores.json You stick with that for now, but I might look into using this since it seems to provide a lot of data: https://developer.sportradar.com/apps/mykeys Key: z6n8shdh69pfkjz5r2ycfxdp

If you can implement it with the sportsradar one, great! but no worries if thats not possible now.