express-skeleton

yarn install
# or npm install
yarn dev
# npm run dev

middleware

// src/routes/auth.route.ts
this.router.use(AuthMiddleware); // for all
this.router.post('/register', AuthMiddleware, this.authController.register); // for single

// src/app.ts
app.use(AuthMiddleware); // 全域

架構圖

/src controllers/ middleware/ requests/ routes/ app.ts router.ts

Acknowledgements

用 TypeScript 寫 express — Route 與 Controller 篇 By Kuan

[筆記] 把玩 express-validator 在伺服器端做表單驗證