This is the server side application for MyFlix, a movie database application. It includes the backend API for managing users, movies, and user interactions.
- Node.js: JavaScript runtime
- Express.js: Web application framework for Node.js
- MongoDB: NoSQL database
- Mongoose: MongoDB object modeling for Node.js
- Passport.js: Authentication middleware for Node.js
- JWT (JSON Web Tokens): Authentication strategy
- Cors: Cross-Origin Resource Sharing middleware
- Body-parser: Request body parsing middleware
- Morgan: HTTP request logger middleware
- Clone the repository.
- Install dependencies using
npm install
. - Set up your MongoDB connection URI in the
process.env.CONNECTION_URI
variable. - Run the application with
npm start
.
- Endpoint:
GET /movies
- Retrieves a list of all movies.
- Endpoint:
GET /movies/:title
- Retrieves data about a single movie by its title.
- Endpoint:
POST /register
- Allows users to register by providing their information in the request body.
- Endpoint:
PUT /users/:Username
- Allows users to update their information. Provide the updated user data in the request body.
- Endpoint:
POST /users/:Username/movies/:MovieID
- Allows users to add a movie to their list of favorite movies.
- Endpoint:
DELETE /users/:Username/movies/:MovieID
- Allows users to remove a movie from their list of favorite movies.
- Endpoint:
DELETE /users/:Username
- Allows users to deregister. No request body is required.
- Homepage:
GET /
- Returns a welcome message.
In case of errors, the server will respond with appropriate error messages and status codes. Additionally, detailed error logs are available in the log.txt
file.
Authentication is implemented using JWT (JSON Web Tokens). Users can log in using the /login
endpoint, and subsequent requests requiring authentication should include the JWT token in the authorization header.
For a more visual representation of the API, you can check the documentation.html provided.
Michael Cameron Smith
Your contributions are invaluable in enriching my knowledge and fostering growth. I wholeheartedly invite your input and suggestions to enhance this project. Whether it's sharing insights, offering feedback, or proposing improvements, your collaboration is pivotal. Let's embark on this journey together, advancing our expertise in the realm of web development.