In this mini-project, you will build Rest API routes for creating, retrieving, and deleting movies from a MySQL database.
-
As a user, I want to create a new database.
-
As a user, I want to store movie names and reviews in the database in two separate table.
-
As a user, I want to see a list of all movies.
-
As a user, I want to be able to create and delete a movie.
-
As a user, I want to return a list of all the reviews and the associated movie name.
-
It's done when
movie_db
is created and contains amovies
andreviews
table. -
It's done when
movie_db
has been seeded with data. -
It's done when the
/api/movies
route renders a list of all movies. -
It's done when the
/api/add-movie
route successfully adds a movie when tested using Insomnia. -
It's done when the
/api/update-review
route successfully updates a movie when tested using Insomnia. -
It's done when the
/api/movie/:id
route deletes a route when tested using Insomnia.
Design the following database schema that contains two tables:
To test your routes you will use Insomnia. If you have not already downloaded it, you will need to visit the Insomnia download page and do so.
Refer to the documentation:
Insomnia documentation on getting started
Express.js documentation on routing
How can you link your movies
and reviews
tables?
How can you execute a query in an Express.js server using the npm MySQL2
package?
If you have completed this activity, work through the following challenge with your partner to further your knowledge:
- How can you add a route to update a review?
Use Google or another search engine to research this.
© 2023 edX Boot Camps LLC. Confidential and Proprietary. All Rights Reserved.