Testing the Reviews API
Explore the process of testing the reviews API endpoints in your backend server. Learn to retrieve movie IDs, add new reviews, edit existing ones, and delete reviews while verifying changes in MongoDB Atlas. Understand how to validate request data and use tools like Insomnia for comprehensive API testing.
We'll cover the following...
We'll cover the following...
In this lesson, we’ll test the reviews API of our back-end server.
MOVIEREVIEWS_DB_URI=mongodb+srv://admin:hello@cluster0.yjxj4.mongodb.net/sample_mflix?retryWrites=true&w=majority MOVIEREVIEWS_NS=sample_mflix PORT=5000
The back-end server we will test
To test the reviews API, we first need to get an existing MovieId. We can send a GET request to the route /api/v1/movies to retrieve all movies and then pick any MovieId.
Testing the add review endpoint
Next, let’s ...