As a newcomer to the world of JavaScript programming, I've taken on the challenge of building a rest API for soccer game stats using express JavaScript.
I successfully developed a rest API that manages leagues by creating/showing/updating/deleting them. I created a controller with all these functions and linked each function to a specific route such as www.test.com/soccer/leagues, www.test.com/soccer/league:id, etc. Everything is functioning smoothly.
Now, my goal is to create a rest API that handles teams. Specifically, I want to display all teams participating in a particular league on the league's view at the route like www.test.com/soccer/league:id.
To achieve this, I have set up a new controller with functions for creating/updating/showing all teams/deleting a team and connected this controller to the team routes such as www.test.com/soccer/leagues/team:id.
My query is, how should I manage this? How can I pass the team data to the specific league's route?