Nest.js custom template with some default features.
$ pnpm install
# development watch mode
$ pnpm run dev
# production mode
$ pnpm run start:prod
# unit tests
$ pnpm run test
# e2e tests
$ pnpm run test:e2e
# test coverage
$ pnpm run test:cov
# create API
$ pnpm run g <API-NAME>
-
Server dev tự động theo dõi sự thay đổi của code và restart (sử dụng swc để x20 lần tốc độ build).
-
Lệnh rút gọn để tạo mới API có sẵn input validate.
-
API nhận tất cả các method (sử dụng build-in decorator @all).
-
Global prefix cho toàn bộ controller (host/v1/path).
-
Các giá trị của env sẽ động tuỳ theo NODE_ENV.
-
Các giá trị constant dùng chung cho toàn bộ env.
-
unit test case cho service.
-
color log
-
Serve static at /public/*
-
Automatic logging request
-
Set cors allow all origin
-
khi sv sập thì trả về 500 thay vì đứt ngang
-
api 404
-
Service hash salt password
-
khai báo midleware
-
tinh giản khai báo controller api
-
khai báo nested controller api
-
tách riêng module test ra
-
import @/ thay cho src/
-
Tạo sẵn res.ok và res.err.
-
i18n: https://nestjs-i18n.com
-
upload file: https://docs.nestjs.com/techniques/file-upload
-
rate limit: https://docs.nestjs.com/security/rate-limiting
-
req allParams và nhận dto validator
-
req err nhận i18n tự động
-
mã gốc của i18n trong res
-
dto validate i18n
-
xử lý cat lỗi dto
-
xử lý các lỗi i18n
-
xoá lỗi ERROR [I18nService] Translation "VALIDATOR.IS_EMAIL" in "vn" does not exist.
- queue
- mongo, postgre
- munti db connect
- ghi log vào ES
- e2e test + case cho api, core, ...
- pm2
- Author - Andrew Nguyen