manage-accounts-service/inserter/README.md

48 lines
1 KiB
Markdown
Raw Permalink Normal View History

2023-08-13 08:51:54 +00:00
### Inserter
This is a program that inserts a data.json file into a redis database.
## Usage
To use this program, you must have a redis database running on your machine. You can download redis [here](https://redis.io/download).
To run the program, you must have a data.json file in the same directory as the inserter.py file. The data.json file must be in the following format:
```
{
"user1@example.com": {
"Name": "John Doe",
"Email": "user1@example.com",
"Phone": "555-1234",
"EmployeeID": "EMP001"
},
"user2@example.com": {
"Name": "Jane Smith",
"Email": "user2@example.com",
"Phone": "444-5678",
"EmployeeID": "EMP002"
},
}
```
## Install
```
npm install
```
## ENV
```
export REDIS_CONNECTION_URL=redis://localhost:6379
```
Or use the .env.example file
## Run
```
npm run dev
```
## Output
This program will remove all in redis and insert new data by the data.json file.
the users collection will be inserted in a transaction mode with the redis database, with expiration of 4 days.