A progressive Node.js framework for building efficient and scalable server-side applications.
This project implements the "My List" feature for an Stage OTT platform, allowing users to manage their personalized list of favorite movies and TV shows.
- Features
- Technologies Used
- Installation
- Database Setup
- Running the Application
- API Endpoints
- Testing
- Directory Structure
- Add to My List: Add a movie or TV show to the user's list.
- Remove from My List: Remove a movie or TV show from the user's list.
- List My Items: Retrieve all items in the user's list with pagination support.
- Backend Framework: NestJS
- Database: MongoDB
- Configuration Management: @nestjs/config
- ORM: Mongoose
- Testing Framework: Jest
- Clone the repository:
$ git clone <repository_url>
$ cd my-list-service
$ npm install
$ MONGODB_URI=<your_mongodb_connection_string>
- Ensure MongoDB is running and accessible.
- Seed the database with initial data:
$ npm run seed
- Start the application:
$ npm run start:dev
- The service will be available at http://localhost:3000.
- Add to My List:
- URL: /my-list/add
- Method: POST
- Request Body:
{
"userId": "user1",
"itemId": "movie1"
}
- Response:
{
"_id": "unique_id",
"userId": "user1",
"itemId": "movie1"
}
- Remove to My List:
- URL: /my-list/remove
- Method: DELETE
- Request Body:
{
"userId": "user1",
"itemId": "movie1"
}
- Response:
{
"message": "Item removed from list"
}
- List My Items
- URL: /my-list/list
- Method: GET
- Query Parameters:
- userId: User ID
- page: Page number (default: 1)
- limit: Number of items per page (default: 10)
- Response:
[
{
"_id": "unique_id",
"userId": "user1",
"itemId": "movie1"
}
]
- Run the Tests
$ npm run test
my-list-service/
├── src/
│ ├── app.module.ts
│ ├── main.ts
│ ├── my-list/
│ │ ├── my-list.controller.ts
│ │ ├── my-list.module.ts
│ │ ├── my-list.service.ts
│ ├── schemas/
│ │ ├── mylist.schema.ts
│ │ ├── movie.schema.ts
│ │ ├── tvshow.schema.ts
│ │ ├── user.schema.ts
│ ├── scripts/
│ │ └── seed.ts
├── test/
│ ├── app.e2e-spec.ts
│ ├── jest-e2e.json
├── .env
├── package.json
├── tsconfig.json
└── README.md