-
入口
main.ts
:引入配置,启动主程序,引入各种全局服务app.module.ts
:主程序根模块,负责各业务模块的聚合app.controller.ts
:主程序根控制器app.service.ts
: 主程序根服务app.config.ts
:配置文件app.environment.ts:
全局环境变量
-
目录
constants
:系统常量decorators
:自定义的装饰器errors
: 自定义的错误状态filters
:异常处理guards
:自定义的守卫interceptors
: 自定义的注入器interfaces
:接口middlewares
:自定义中间件modules
: 应用模块pipes
:管道processors
:三方库连接transforms
:转换工具
-
环境变量
.env
-
请求处理流程
request
:收到请求middleware
:中间件过滤(跨域、来源校验等处理)guard
:守卫过滤(鉴权)interceptor:before
:数据流拦截器pipe
:参数提取(校验)器controller
:业务控制器service
:业务服务interceptor:after
:数据流拦截器(格式化数据、错误)filter
:捕获以上所有流程中出现的异常,如果任何一个环节抛出异常,则返回错误
$ yarn
# staging
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
$ yarn run start:prod
v2
swagger自动生成
http://localhost:3000/api