My JS Soccer Project

Antonio Esp
3 min readSep 14, 2021

In this Javascript project, I learned a lot. I had previously worked with an API when I had constructed my first Ruby Project. I really looked forward to working on this project, due to that fact that is was over one of my life’s passions, soccer. I had spent a few days brainstorming and wondering “What project should I do this time?” I finally came to the conclusion that this would be the best idea for my project. I started asking myself, “Why did it take me so long to come up with this idea?”I did take a while to locate an API. The first few I tried denied me access to be able to use the API, I luckily located one in one of the links in the lessons.

First I started to build my api.js file. I first had to write a static method to fetch the competitions from the API. I had noticed that when I was trying to open some of the competitions, the API only allowed me access to certain competitions. I ended up having to write an if statement starting on line 15 where the competitions listed in the array were included, to then call on the render function. That was one of the difficulties that I had while building this project. I then proceeded to write the functions to fetch teams and then players.

api.js

I next had to build my competition.js file. Making the constructor was rather easy since I just had to put the competition ID and name.

competition.js

Making my team.js was very time consuming. In my constructor, I had to put the id, name, club colors, venue, and competition ID.

team.js

Building my render function took a while due to the fact that I had to add my attributes from my constructor in my player.js file and put them in the team.innerHTML.

team.js

In the player.js container I put the player’s id, name, position, date of birth, birth nation, nationality, role, and team they play for.

player.js

Overall this project was really fun. I am an avid follower of world soccer. I had the pleasure of making this and seeing a lot of the leagues, teams, players, and soccer competitions that I follow.

--

--