Creating the Movies Controller
Let's learn how to create a controller that the route file can use to access the dao file.
We'll cover the following...
We'll cover the following...
In this lesson, we’ll create a controller to access the moviesDAO.js file, which we created previously.
MOVIEREVIEWS_DB_URI=mongodb+srv://admin:hello@cluster0.yjxj4.mongodb.net/sample_mflix?retryWrites=true&w=majority MOVIEREVIEWS_NS=sample_mflix PORT=5000
The initial files we will build on
Creating a movie controller
In the api folder, let’s create a new file movies.controller.js with the following code:
Line 1: We first import MoviesDAO from the the dao directory.
Lines 3–6: ...