Skip to content

A TS express boilerplate using typedi and routing-controllers.

Notifications You must be signed in to change notification settings

tanghongxin/express-ts-boilerplate

Repository files navigation

express-ts-boilerplate

A TS express boilerplate using typedi and routing-controllers.

Pre-configuration

  • Dotenv support
  • Commonly used middlewares
    • CORS
    • DDos protection
    • Gzip
    • HTTP log
    • Global error handler
    • Attachment upload

Dev

git clone https://github.com/tanghongxin/express-ts-boilerplate.git
cd express-ts-boilerplate
pnpm i
pnpm dev

API Example

Notes

You are supposed to import database configuration and logic by yourself.

It's recommended to process DB Logic in Services instead of Controllers.

More use DTO to verify incoming data.

Structure

├── bundle ------------------- TS output dir
├── logs --------------------- log4js output dir
├── nodemon.json
├── package-lock.json
├── package.json
├── shell -------------------- Start script
├── src
│   ├── controllers ---------- MVC - Controllers
│   ├── dto ------------------ Data Transfer Object
│   ├── exceptions ----------- Custom exceptions
│   ├── index.ts ------------- Entry file
│   ├── middlewares ---------- Express middlewares
│   ├── services ------------- MVC - Services
│   ├── utils ---------------- TS functions
├── uploads ------------------ Attachment upload dir
├── tsconfig.json
└── types

References

About

A TS express boilerplate using typedi and routing-controllers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published