Currently, our homepage has all the static movies in the content. Let's fill the data with the data that we have added to the movies in our database. For that, the first thing to do is to add a few movies to the database, which we can do via the http://localhost:8080/movies/add endpoint from the UI.
Loading dynamic content on the homepage
API endpoint to fetch all movies
First, we need to add an endpoint to fetch all the movies from the Mongo database. So, let's first add an endpoint to fetch all the movies in controllers/movies.js:
const MovieSchema = require('../models/Movie.js');
module.exports.controller = (app) => {
// fetch all movies
app.get('/movies', (req, res) => {
MovieSchema...