nestjs快速开发项目

整合了nestjs项目通用架构、常用功能集成的一个快速开发项目。 项目地址:https://github.com/YES-Lee/nest-seed-proj 集成功能 ORM: sequelize API: restful api, graphql 认证:passport 文档:swagger 安全:helmet 日志:nest-pino 功能不断完善,将来或提供可插拔的开发体验 快速开始 # 拉取代码 git clone https://github.com/YES-Lee/nest-seed-proj.git cd nest-seed-proj yarn install # or npm intall yarn start:dev # or npm run start:dev 项目结构 src ├─ config // 配置模块 ├─ database // 数据库模块 │ └─ models // 存放sequelize/graphql数据库模型 ├─ decorators // 自定义装饰器目录 ├─ dto // restful 接口模型目录 ├─ graphql // graphql 模块 ├─ enums // 枚举目录 ├─ filters // error filters ├─ interceptors // interceptors ├─ pipes // pipes └─ modules // 业务逻辑模块目录,所有业务相关逻辑都放到该目录对应的模块 接口格式 { error_code: number // 错误码,只在异常时返回 error_message: string // 错误信息,只在异常时返回 data: any timestamp: any // 时间戳 path: string // 请求路径 } dtc/support中提供了ApiResponse类,提供了success, error两个静态方法。...

February 15, 2020 · 2 min · 284 words · Johnson