Making request format for our API
For this lab, We will be making 2 views for which we will define 2 request links using.
The 2 views will be:
- View all movies - "/movies"
- View movies at rank x - "/movies/x
Here, We will create 2 functions to do our task. In both cases, We will use jsonify library to return data in JSON format.
Task 1:
In this task, we have to show all the movies in JSON format for this task. The route will be "/movies" and we will use the GET method.

Task 2:
In this task, We have to show a movie corresponding to the requested rank. For this, we will use the route "/movies/x" and the GET method as defined above. To get the movie corresponding to the rank, We can simply iterate through all the movies and compare their ranks with the input.

Now, The API is complete and we just have to test it.
5
