forked from ttc/micro-service-api
-first commit
This commit is contained in:
53
@knowleadge/setup_project.txt
Normal file
53
@knowleadge/setup_project.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
🚀 PART 1 : สร้างโปรเจ็กต์หลัก
|
||||
📁 1. เปิดโฟลเดอร์หลักของระบบ
|
||||
E:\Skyz\micro-service-api
|
||||
📦 2. สร้างไฟล์หลัก
|
||||
mkdir shared
|
||||
mkdir gateway-api
|
||||
mkdir exthernal-mobile-api
|
||||
|
||||
🧱 PART 2 : ติดตั้ง Node.js โปรเจกต์
|
||||
🌐 1. สร้าง package.json ในแต่ละ service
|
||||
|
||||
|
||||
cd gateway-api
|
||||
npm init -y
|
||||
cd ../exthernal-mobile-api
|
||||
npm init -y
|
||||
|
||||
|
||||
📦 2. ติดตั้ง dependencies หลัก
|
||||
npm install express pg cors dotenv
|
||||
|
||||
npm install express-session connect-redis ioredis
|
||||
|
||||
npm install --save-dev nodemon
|
||||
|
||||
npm install -g nodemon
|
||||
|
||||
npm install jsonwebtoken
|
||||
|
||||
ติดตั้ง Redis
|
||||
|
||||
|
||||
|
||||
|
||||
✏️ 3. เพิ่ม script ใน package.json
|
||||
"scripts": {
|
||||
"start": "node src/app.js",
|
||||
"dev": "nodemon src/app.js"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
⚙️ วิธีรันแต่ละ service
|
||||
|
||||
จาก root (micro-service-api):
|
||||
|
||||
# เริ่มโปรแกรมหลัก
|
||||
npm run dev
|
||||
|
||||
# หรือเริ่มเฉพาะ API ย่อย
|
||||
npm run start:mobile
|
||||
npm run start:wep
|
||||
Reference in New Issue
Block a user