The Code
The code is structured in three functions
getMovies()
getMovies() is a async function that makes a GET
call to the TMDB API in order to return a list movies to display on the page.
variable
displayMovies()
displayMovies() is a function that uses the data
fetched in the GET API call from getMovies().
Once the data is recieved, a forEach() is used to loop
through the data object and that object is used to build the template element that
holds different HTML elements to display the movie and information about that movie. In addtion
to building the different HTML elements with data from the object, a custom attriubute is set on the
button in order to be used by the showMOvieDetails(btn) function.
showMovieDetails(btn)
showMovieDetails(btn) is a async fucntion that takes a button as a parameter.
From this parameter, the custom attribute data-moiveId is used in the
GET API call in order to return details about a particular movie.
Once the data is recieved, that data is used to build the movie modal which will display more
details about the movie once the more info button is clicked.