My-movie-api is the server-side component of a “Netflix” web application. The web application provides users with access to information about different movies, directors, and genres. Users are able to sign up, update their personal information, and create a list of their favorite movies.
My-movie-api is a personal project developed during my web development course at CareerFoundry, showcasing my expertise in server-side programing.
This is an API for an app called “Nightflix” that interacts with a database that stores data about different movies based on MERN-Teckstack (MongoDb, Express, React, Node.js), and access to that data is provided via a REST API (also known as a “RESTful API”).
The overall goal of the project was to build a REST API.
I started the Backend part of the project in Februar’2024 with my first commit and the official work on the project ended in April’24.
To begin the development process, I started by writing user stories based on the app’s key features. These user stories served as the foundation for understanding the application's core functionality and user requirements. I set up the project directory: Created the project repository, deployed the initial structure of the project, and pushed the first commit to GitHub.
In the "my-movie-api" project, at the beginning of the project I implemented the following components and functionality:
Created Key Files:
At this point I deleted the test.js and server.js files. Created an index.js file in the project directory, initialized the project using npm init, generating a package.json file with the main field set to index.js and installed essential local dependencies:
Added the node_modules folder to a .gitignore file to exclude it from version control, as all dependencies are tracked in package.json.
This setup establishes the foundation for building and running the application.
Setup and Folder Structure: Ensured the project directory contained the following essential files and folders:
As defined the REST API must do the following:
Created a non-relational (NoSQL) database using MongoDB: installed, configured and ran a MongoDB database.
Movies Collection: Added about 10 movie documents to a “movies” collection. Used embedded documents to store information about genre, director, and additional attributes in a standardized format between all documents in the collection.
Users Collection: Added at least 5 user documents to a “users” collection. The Birthday attribute is stored as a Date data type. Used references to store a list of favorite movies for each user.
Made changes to the Database querying it: performing various operations like finding, filtering, sorting, updating, and deleting.
Created the schema for the database using Mongoose models so that they can be used by the rest of the application.
Implemented authentication and authorization into the API using basic HTTP authentication and JWT (token-based) authentication.
Integrated two Passport strategies as middleware into each of the existing API endpoints so that only users with a JWT token can make requests to your API and tested each method using Postman.
Modified API to align with data security regulations: Implement data security and storage controls. incorporated data validation logic into the API.
Deployed the API to online hosting service: hosted the API to the cloud PaaS (Platform as a Service) platform Heroku.
Deployed the database to the cloud-based database hosting platform MongoDB Atlas, and made sure all these moving parts of the app are synced up to work perfectly together.
The my-movie-api project was a comprehensive backend development exercise that showcased the process of designing and implementing a robust RESTful API for a movie database application, "Nightflix." From conceptualization to deployment, this project demonstrated the use of the MERN stack to build a functional server-side application.
By integrating technologies like Node.js, Express.js, and MongoDB, the project effectively managed routing, user authentication, data storage, and API functionality. Key achievements included the implementation of RESTful API endpoints, user authentication with JWT and Passport.js, secure data storage using MongoDB Atlas, and deploying the application on Heroku for real-world access.
This project emphasized modularity, maintainability, and scalability, with features such as logging using Morgan, error handling, and static file serving. Testing tools like Postman ensured the API's functionality and security compliance. With this solid foundation, the project paves the way for the development of a polished client-side interface in the next phase, making it a significant addition to my portfolio.