This web application is built using the MERN stack, which stands for MongoDB, Express.js, React, and Node.js. It allows users to create an account, search for different movies, read details about the movies' directors and genres, and add or remove movies from their favorites list.
GET /movies
: Retrieve all movies.GET /movies/:title
: Retrieve a movie by title.GET /movies/Genre/:GenreName
: Retrieve movies by genre.GET /Director/:DirectorName
: Retrieve a director by name.POST /users
: Create a new user.PUT /users/:Username
: Update user information.POST /users/:Username/movies/:MovieID
: Add a movie to favorites.DELETE /users/:Username/movies/:MovieID
: Remove a movie from favorites.DELETE /users/:Username
: Delete a user.
This application leverages the Mongoose library to define schemas for managing data in a MongoDB database. The schemas include Genre, Director, Movie, and User. Each schema specifies the structure of the documents in the database.
For example, the Genre schema captures basic attributes such as Name and Description, while the Director schema includes additional fields like Bio and Birth. The Movie schema references both Genre and Director using their respective Object IDs, enabling relational data management. It also stores metadata such as Title, Description, ImagePath, and a boolean Featured flag.
Similarly, the User schema stores information about registered users, including their Username, Password, Email, and an array of FavoriteMovies, which are references to the Movie schema. The application also includes filtering capabilities, allowing users to dynamically search for movies by title.
Authentication is implemented using Passport.js with JWT (JSON Web Token) to secure protected routes. The app also includes logout functionality to clear stored data and reset the session. Bootstrap is used to style and structure the application, offering a responsive layout with features like search bars, modals, and navbars.