From d0fcf7baa6821a62f4b2ea083fc4442ac03eccb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A0nh=20Duy?= <21520774@gm.uit.edu.vn> Date: Wed, 5 Jun 2024 16:00:51 +0700 Subject: [PATCH 1/5] Update node.js.yml --- .github/workflows/node.js.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 15ecaed..97c19ff 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -24,6 +24,5 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: echo $'DEV_APP_PORT=${{secrets.DEV_APP_PORT}}\nPRO_APP_PORT=${{secrets.PRO_APP_PORT}}\nDEV_DB_HOST=${{secrets.DEV_DB_HOST}}\nDEV_DB_NAME=${{secrets.DEV_DB_NAME}}\nPRO_DB_HOST=${{secrets.PRO_DB_HOST}}\nPRO_DB_PORT=${{secrets.PRO_DB_PORT}}\nPRO_DB_NAME=${{secrets.PRO_DB_NAME}}\nPRO_MONGODB_URL=${{secrets.PRO_MONGODB_URL}}\nTIMEOUT_REDIS=${{secrets.TIMEOUT_REDIS}}\nPORT_REDIS=${{secrets.PORT_REDIS}}\nUSERNAME_REDIS=${{secrets.USERNAME_REDIS}}\nPASSWORD_REDIS=${{secrets.PASSWORD_REDIS}}\nCLOUDINARY_CLOUD_NAME=${{secrets.CLOUDINARY_CLOUD_NAME}}\nCLOUDINARY_API_KEY=${{secrets.CLOUDINARY_API_KEY}}\nCLOUDINARY_API_SECRET=${{secrets.CLOUDINARY_API_SECRET}}'> .env - run: npm ci - run: pm2 restart server From 4acd92e4f3542cd964217c78352c19cb98648c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A0nh=20Duy?= <21520774@gm.uit.edu.vn> Date: Wed, 5 Jun 2024 16:06:54 +0700 Subject: [PATCH 2/5] Update node.js.yml --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 97c19ff..232d0fb 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [20.x] + node-version: [20.14] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ environment: 'E-Shop Production' From 0877111744400a1921e0bf17bf7b7e9a00d2e999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A0nh=20Duy?= <21520774@gm.uit.edu.vn> Date: Wed, 5 Jun 2024 17:37:25 +0700 Subject: [PATCH 3/5] Update node.js.yml --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 232d0fb..0ef2ec8 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -25,4 +25,4 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci - - run: pm2 restart server + - run: pm2 start server From 5b7a66ebfbf840de135c092e9be4dbac042fbca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A0nh=20Duy?= <21520774@gm.uit.edu.vn> Date: Wed, 5 Jun 2024 17:44:49 +0700 Subject: [PATCH 4/5] Update node.js.yml --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 0ef2ec8..232d0fb 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -25,4 +25,4 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci - - run: pm2 start server + - run: pm2 restart server From 20d35f090117c7c9137dd055b6315690e85999ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A0nh=20Duy?= <21520774@gm.uit.edu.vn> Date: Thu, 13 Feb 2025 23:56:39 +0700 Subject: [PATCH 5/5] Update README.md --- README.md | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0739130..f0e0669 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,44 @@ -# EShop_BE_NodeJS +# EShop Backend (Node.js) -EShop Backend NodeJS là một dự án backend cho một trang Web bán sản phẩm điện tử. -Trong dự án này có đầy đủ các tính năng cơ bản như CRUD user, product, cart, voucher, order... -Ngoài ra dự án còn được triển khai một số chức năng khác: +## Overview +**EShop Backend NodeJS** is a backend service for an e-commerce platform specializing in electronic products. This project provides a robust and scalable API for managing users, products, carts, vouchers, and orders. It is designed to handle high concurrent purchases efficiently and includes various essential functionalities to enhance the e-commerce experience. -- Xử lý lượng mua đồng thời cao(sử dụng mô hình khóa bi quan triển khai với redis). -- Tìm kiếm sản phẩm(dựa trên text index của MongoDB). -- Upload ảnh lên cloudinary. -- Hệ thống ghi log với winston. +## Features +- **CRUD Operations**: Manage users, products, carts, vouchers, and orders. +- **High Concurrent Purchase Handling**: Implements pessimistic locking using Redis to prevent conflicts in simultaneous purchases. +- **Product Search**: Utilizes MongoDB's text indexing for efficient product search. +- **Image Uploading**: Integrates with Cloudinary for image storage and management. +- **Logging System**: Implements Winston for structured logging and monitoring. + +## Tech Stack +- **Backend Framework**: Express.js +- **Database**: MongoDB +- **Caching & Locking**: Redis +- **File Storage**: Cloudinary +- **Logging**: Winston + +## API Documentation +Explore the full API documentation in Postman: [EShop API Documentation](https://documenter.getpostman.com/view/26918732/2sA3JGf3wq) + +## Getting Started +### Clone the repository +```sh +git clone https://github.com/DuyDangCode/EShop_BE_NodeJS.git +``` + +### Install dependencies +```sh +npm install +``` + +### Start the server +```sh +npm run start +``` + +## License +This project is licensed under the MIT License. + +## Contact +For any inquiries, please contact ndt.duy.dev@gmail.com. -Postman: https://documenter.getpostman.com/view/26918732/2sA3JGf3wq