MovieStore-API is a RESTful API for managing movies, user watchlists, and reviews. It supports CRUD operations for movies and allows users to create and manage their watchlists and reviews.
- Features
- Technologies
- Installation
- Environment Variables
- Usage
- API Endpoints
- License
- Contributing
- Contact
- User authentication and authorization
- CRUD operations for movies
- User-specific watchlists
- User-specific reviews
- Secure handling of user passwords and JWT tokens
- Node.js
- Express.js
- MongoDB
- Mongoose
- JWT for authentication
- bcrypt for password hashing
- dotenv for environment variables
-
Clone the repository:
git clone https://github.com/abdul-nishar/MovieStore-API.git cd MovieStore-API
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and add the following environment variables:NODE_ENV=development PORT=3000 DATABASE=your_mongodb_connection_string JWT_SECRET=your_jwt_secret JWT_EXPIRY_TIME=1800 JWT_COOKIE_EXPIRY_TIME=1800
-
Start the server:
npm start
NODE_ENV
: The environment in which the application is running (e.g., development, production).PORT
: The port on which the server will run.DATABASE
: The MongoDB connection string.JWT_SECRET
: The secret key for signing JWT tokens.JWT_EXPIRY_TIME
: The expiry time for JWT tokens (in seconds).JWT_COOKIE_EXPIRY_TIME
: The expiry time for JWT cookies (in seconds).
-
To run the server in development mode:
npm run dev
-
To run the server in production mode:
npm start
- POST /api/v1/users/signup: Sign up a new user
- POST /api/v1/users/login: Log in an existing user
- GET /api/v1/users/logout: Log out the current user
- GET /api/v1/movies: Get all movies
- POST /api/v1/movies: Create a new movie (Admin)
- GET /api/v1/movies/:id: Get a specific movie by ID
- PATCH /api/v1/movies/:id: Update a specific movie by ID (Admin)
- DELETE /api/v1/movies/:id: Delete a specific movie by ID (Admin)
- GET /api/v1/watchlist: Get the current user's watchlist
- POST /api/v1/watchlist: Add an item to the current user's watchlist
- DELETE /api/v1/watchlist/:id: Remove an item from the current user's watchlist
- GET /api/v1/reviews: Get all reviews
- POST /api/v1/reviews: Create a new review
- GET /api/v1/reviews/:id: Get a specific review by ID
- PATCH /api/v1/reviews/:id: Update a specific review by ID
- DELETE /api/v1/reviews/:id: Delete a specific review by ID
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please read the CONTRIBUTING guidelines first.
If you have any questions or suggestions, feel free to reach out to me at sheikhabdul285@gmail.com.