Cineflix Movie Rental API is a Node.js-based REST API for managing movie-related information, including genres, movies, customers, rentals, users, authentication, and returns.
Cineflix Movie Rental API provides a set of endpoints for interacting with movie-related data, enabling users to perform actions such as retrieving genres, movies, and customer information, managing rentals, authenticating users, and handling movie returns.
- Retrieve information about genres, movies, customers, and rentals.
- Manage movie rentals, user authentication, and returns.
- Secure and authenticated access to certain endpoints.
- Easily extendable and customizable.
- Node.js installed on your machine.
- MongoDB database for data storage.
Clone the repository and install dependencies.
git clone <repository-url>
cd cineflix-movie-rental-api
npm install
Start the API server.
npm start
Run the provided test suite to ensure the functionality of the API.
npm test
Cineflix Movie Rental API provides several endpoints for managing movie-related information. Below is a comprehensive list of available endpoints, along with their methods, purposes, and expected request and response formats.
- Endpoint:
/api/genres
- Method: GET
- Description: Retrieve a list of all genres.
- Response Format: JSON Array of Genres.
- Endpoint:
/api/genres
- Method: POST
- Description: Add a new genre.
- Request Format: JSON Object with
name
property. - Response Format: JSON Object representing the newly added genre.
- Endpoint:
/api/movies
- Method: GET
- Description: Retrieve a list of all movies.
- Response Format: JSON Array of Movies.
- Endpoint:
/api/movies
- Method: POST
- Description: Add a new movie.
- Request Format: JSON Object with movie details.
- Response Format: JSON Object representing the newly added movie.
- Endpoint:
/api/customers
- Method: GET
- Description: Retrieve a list of all customers.
- Response Format: JSON Array of Customers.
- Endpoint:
/api/customers
- Method: POST
- Description: Add a new customer.
- Request Format: JSON Object with customer details.
- Response Format: JSON Object representing the newly added customer.
- Endpoint:
/api/rentals
- Method: GET
- Description: Retrieve a list of all rentals.
- Response Format: JSON Array of Rentals.
- Endpoint:
/api/rentals
- Method: POST
- Description: Rent a movie.
- Request Format: JSON Object with rental details.
- Response Format: JSON Object representing the newly created rental.
- Endpoint:
/api/users
- Method: GET
- Description: Retrieve user details.
- Response Format: JSON Object representing user details.
- Endpoint:
/api/users
- Method: POST
- Description: Add a new user.
- Request Format: JSON Object with user details.
- Response Format: JSON Object representing the newly added user.
- Endpoint:
/api/auth
- Method: POST
- Description: Authenticate a user and generate an authentication token.
- Request Format: JSON Object with
email
andpassword
properties. - Response Format: JSON Object containing the authentication token.
- Endpoint:
/api/returns
- Method: POST
- Description: Handle movie returns.
- Request Format: JSON Object with rental ID.
- Response Format: JSON Object representing the returned movie details.
Note: Certain endpoints require authentication. Ensure you have obtained an authentication token by logging in via the /api/auth
endpoint before accessing authenticated endpoints.
Feel free to explore each endpoint for specific details about request and response formats.