TodoSystemMicroService-NodeJS/README.md

62 lines
1.9 KiB
Markdown
Raw Normal View History

2023-07-07 22:54:57 +00:00
# Project Setup Instructions
2023-07-09 13:34:42 +00:00
This README.md file provides instructions for setting up and running various components of the project, including MongoDB, BarbbitMQ, NotificationService, and TodoService. Please follow the steps below to get started.
2023-07-07 22:54:57 +00:00
2023-07-09 09:38:16 +00:00
## MongoDB/Docker && RabbitMQ/Docker
2023-07-07 22:54:57 +00:00
1. Install MongoDB if you haven't already.
2. Navigate to the `/infra/docker/docker-compose` directory.
2023-07-09 09:38:16 +00:00
3. Make sure to add .env by copying .env.example and filling in the values.
4. Run the following command to start MongoDB using Docker Compose:
2023-07-07 22:54:57 +00:00
```shell
docker-compose up -d
2023-07-08 21:00:11 +00:00
```
2023-07-07 22:54:57 +00:00
## NotificationService
2023-07-08 21:00:11 +00:00
2023-07-07 22:54:57 +00:00
Before running the NotificationService, ensure that you have Node.js, TypeScript (tsc), and npm installed.
Navigate to the /notification-service directory.
Run the following command to install the dependencies:
2023-07-08 21:00:11 +00:00
2023-07-07 22:54:57 +00:00
```npm
npm install
```
2023-07-08 21:00:11 +00:00
2023-07-07 22:54:57 +00:00
Run the following command to build and run (Dem mode)the project:
2023-07-08 21:00:11 +00:00
2023-07-07 22:54:57 +00:00
```npm
npm run dev
```
## TodoService
2023-07-08 21:00:11 +00:00
Before running the TodoService, ensure that you have Node.js, TypeScript (tsc) and npm installed.
2023-07-07 22:54:57 +00:00
Navigate to the /todo-service directory.
Run the following command to install the dependencies:
2023-07-08 21:00:11 +00:00
2023-07-07 22:54:57 +00:00
```npm
npm install
```
2023-07-08 21:00:11 +00:00
2023-07-07 22:54:57 +00:00
Run the following command to build and run (Dem mode)the project:
2023-07-08 21:00:11 +00:00
2023-07-07 22:54:57 +00:00
```npm
npm run dev
```
## Requests
2023-07-08 21:00:11 +00:00
Examples are located in request.http - can be run in VSCode with the REST Client extension.
2023-07-09 09:38:16 +00:00
## notification-service business logic
1. When a new todo is created, the notification-service will receive a message from the todo-service with delay time due_date - current_time.
2. The notification-service will then send a message to rabbitmq with the delay time.
3. When the delay time is up, the notification-service will receive a message from rabbitmq and send a notification to the user by the following logic:
a. If the todo is no "pending" status and due_date is smaller then current time, send a notification to the user.
b. If the todo is already completed, do nothing.