No description
Find a file
2024-07-10 17:53:27 +07:00
src first commit 2024-07-10 17:53:27 +07:00
static first commit 2024-07-10 17:53:27 +07:00
.dockerignore first commit 2024-07-10 17:53:27 +07:00
.env.example first commit 2024-07-10 17:53:27 +07:00
.gitignore first commit 2024-07-10 17:53:27 +07:00
.prettierignore first commit 2024-07-10 17:53:27 +07:00
.prettierrc first commit 2024-07-10 17:53:27 +07:00
CHANGELOG.md first commit 2024-07-10 17:53:27 +07:00
cliff.toml first commit 2024-07-10 17:53:27 +07:00
Dockerfile first commit 2024-07-10 17:53:27 +07:00
nodemon.json first commit 2024-07-10 17:53:27 +07:00
package-lock.json first commit 2024-07-10 17:53:27 +07:00
package.json first commit 2024-07-10 17:53:27 +07:00
pnpm-lock.yaml first commit 2024-07-10 17:53:27 +07:00
README.md first commit 2024-07-10 17:53:27 +07:00
tsconfig.json first commit 2024-07-10 17:53:27 +07:00
tsoa.json first commit 2024-07-10 17:53:27 +07:00

TSOA Node.js Template (CJS)

  • โปรเจคนี้เป็นโครงโปรเจคสามารถโคลนและนำไปปรับใช้ได้ทันที
  • โปรเจคนี้ใช้ tsoa express และ swaggerui เป็นหลัก
  • โปรเจคนี้มีการตั้งค่า docker และ prettier ให้พร้อมแล้ว

Step to Reproduce

Tip

ในที่นี้จะใช้ pnpm ที่ดีกว่า npm แทน โดย pnpm add จะมีค่าเท่ากับ npm i

หากต้องการใช้ pnpm สามารถลงได้โดย npm i -g pnpm

ข้อมูลเพิ่มเติม: pnpm

  1. เตรียมและติดตั้งแพคเกจ
    • pnpm init
    • pnpm add -D @types/cors @types/express @types/node @types/swagger-ui-express nodemon prettier ts-node typescript แพคเกจนี้เป็นเพียงแพคเกจทีจะถูกใช้เฉพาะตอนพัฒนาระบบเท่านั้น และไม่ถูกนำไปใช้เพื่อให้ระบบสามารถทำงานได้ แพคเกจเหล่านี้จะไม่ถูกติดตั้งเมื่อนำไปใช้งานจริงบน production
    • pnpm add @tsoa/runtime cors dotenv express fast-jwt mysql2 promise.any reflect-metadata swagger-ui-express tsoa typeorm แพคเกจนี้เป็นแพคเกจที่จำเป็นสำหรับการทำงานของระบบ หากไม่มีจะไม่สามารถทำให้ระบบทำงานได้เมื่อติดตั้งไม่ครบ
  2. ตั้งค่าโปรเจค
  3. ขึ้นโครงแอปพลิเคชัน

Caution

การตั้งค่า src/database/data-source.ts ก่อนขึ้น production ปรับ synchronize เป็น false และเริ่มทำ migrations