Approaching the end of the first phase of this program, I was pretty nervous to get started on the final project. I had to build a Single Page Application that integrated 7 weeks of things that I learned so far. I wasn’t very confident in using fetch since it was something that I had just learned and there was still a lot of things about it that I didn’t understand.
Getting started with the project I had to choose a free API. I’m a big K-Pop stan so I decided to do my project on music, specifically the genre of K-Pop. This lead me to choose the itunes search API. Something that stood out to me, while building this project were dataset attributes.
In my project the default limit of data that my API returned was 50 so I decided to leave it at that and work with an array with 50 different objects. I was able to fetch the data successfully, but when I tried to use .map() to iterate through the array I was receiving an error that said .map() wasn’t a function. I thought that was weird and I was just missing a very important piece of information.
The reason I was getting the error was because the data was in an array called “results”. I didn’t realize that my object had a key. Moral of the story don’t overlook the small things.
For the data attributes in my project I chose to pick out the trackId and trackName. I made a 2nd fetch call later in my code and used interpolation in the fetch call to get data from that specific trackId. I thought it was a pretty neat trick that would be very helpful in the future. This was a SPA and the first project so I probably didn’t need to make that second fetch call and would’ve still been able to get the same end result.
The takeaways I got from this project was to not overlook the small details even when you think they’re not necessary. I think in anything code related it’s always the small things that make a huge impact. One misspelling or forgotten “)” and the whole program won’t run.