This project enhances an OTT platform by adding a "My List" feature, allowing users to save their favorite movies and TV shows to a personalized list. The backend services will manage this list, providing functionality to add, remove, and list saved items.
Problem statement with Instructions and guidelines
Implement scalable and performant APIs for the “My List” feature that any client (web or mobile app) can consume. Comprehensive integration tests are to be included. For now manual tesing is provided
- Add to My List: Add a movie or TV show to the user's list. Each item is uniquely identified and duplicates are not allowed.
- Remove from My List: Remove an item from the user's list using its unique ID.
- List My Items: Retrieve all items in the user's list. Pagination support to be added to efficiently handle large lists.
-
Clone the Repository:
git clone <repository-url> cd <repository-directory>
-
Install Dependencies:
npm install
-
Setup Database and .env File:
- Install mongoDB compass
- Create .env file in the code base & paste this snippet
SERVER_PORT=<PORT> #3001 SERVER_HOSTNAME=<HOST URL> #http://localhost MONGO_URL=<DB_URL> #mongodb://127.0.0.1:27017/<db>
- Configure the
MONGO_URL
according to your connection string. The defualt connection string should bemongodb://localhost:27017
in your mongoDB compass. But, I recommendMONGO_URL
should bemongodb://127.0.0.1:27017
, for smooth operation. - Just replace
localhost
of connection string to127.0.0.1
. Then replace your database name with<db>
. Your db structure should look like this:
- Connect database
-
Run the Application:
npm run dev
If you open the URL, you will see a messege showing like this:
.
Don't worry, its expected
- Click the above github shield to access the Zetflix repository
- Follow instruction to run Zetflix on local host
- Download and open mongoDB compass
- Make sure stage-backend and mongoDB are also running in the backend
- Download postman by clicking the above github shield or install postman extension if you are on vs-code
- Open postman. Postman is really convinient to send all type of requests like
Get
,Post
,Patch
,Delete
etc. - We can interact with 3 databases named movies, tvshows and usernames
- The routes are shown as below:
-
-
POST
: create, update, addGET
: getPATCH
: updateDELETE
: delete
- Necessary attributes for each action is provided below. It is important to send a body, like shown below:
- If you test through Zetflix, this parsing body will not bother you. Mandatory attributes for different function:
- add user, delete user :
{username}
- update user :
{username, newName}
- add movie :
{titleMovie}
- delete movie :
{movieId}
- update movie :
{movieId, newTitle}
- add movie :
{titleTvshow}
- delete movie :
{tvshowId}
- update movie :
{tvshowId, newTitle}
- add user, delete user :
-