Testing the Back-end API

Let's learn how to test the Node.js back-end server.

In this lesson, we’ll test to see if our Node.js back-end server can access the database.

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

Execute the working example set above and append /api/v1/movies to its URL (see image below). This should return our movie results.

The output should be similar to the image below:

If we see the output above, that means our application has successfully queried the database. We can now test the API in our browser, but it’s better to test our API with a tool called Insomnia.

Setting up Insomnia and testing the

...