handler specs
handler 规范
1 代码分层设计
controller-->service-->dao---->model
|
+------>sdk---->第三方服务butterfly
├── conf
│ ├── fx
│ │ └── <app>_<resource>_<action>.toml
│ ├── app
│ │ └── <app>.toml
│ └── servicer
│ ├── mysql_<servicer>.py # 第三方服务配置
│ ├── redis_<servicer>.py # 第三方服务配置
│ └── xx_<xxx>.py # config
└── handlers
└── <app>
├── api_<resource>_<action1>.py # controller
├── api_<resource>_<action2>.py # controller
├── lib_<servicer>.py # service
├── model_xxx.py # dao/model
├── sdk_xxx.py # 第三方服务
├── retstat.py # handler 返回值状态字段
├── const.py # handler 常量定义,避免出现魔数(Magic number)
└── __init__.py1.1 函数命名
2 接口规范
2.1 接口格式组成
2.2 接口格式例子
2.2.1 通用接口格式
2.2.2 登录跳转接口格式
2.2.3 表格分页数据接口格式
2.2.4 图表展示接口格式
3 装饰器
3.1 handler 装饰器
Last updated