apiDoc是一个基于NodeJS的跨语言的,通过读取项目源码注释自动生成API文档的工具。
安装:
npm config set registry https://registry.npm.taobao.org
npm install apidoc -g
示例:
/**
* @apiDefine CommonParams
* @apiParam {string} token 用户身份令牌
* @apiSuccess {integer} code 状态码
* @apiError {string} msg 错误信息
*/
/**
* @apiDefine ErrorToken
* @apiErrorExample {json} token异常示例
* {"code":202,"msg":"TOKEN已失效","data":[],"ts":1616653092}
*/
/**
* @apiDefine CommonBlock
* @apiUse CommonParams
* @apiUse ErrorToken
*/
/**
* @api {GET} /api/whq2021/usersign/getsigninfo 获取签到信息
* @apiGroup 签到管理
* @apiDescription 获取当前用户签到信息
* @apiUse CommonBlock
* @apiSuccess {integer} total_sign 累签次数
* @apiSuccess {Number[]} wheel 幸运大转盘数字列表
* @apiSuccess {Object[]} info 累签信息
* @apiSuccess {integer} info.has_signed 是否可领取
* @apiSuccess {integer} info.has_token 是否已领取
* @apiSuccessExample {json} 成功相应示例
* {"code":200,"msg":"success","data":{"total_sign":0,"continued_sign":0,"today_can_sign":0,"info":[{"total_sign":4,"money":2,"has_signed":0,"has_token":0},{"total_sign":7,"money":5,"has_signed":0,"has_token":0}],"wheel":[0.8,0.3,10,0.2,0.5,1,0.1,5,3,2]},"ts":1616748254}
*/
public function getSignInfo(){}
/**
* @apiIgnore @apiParamExample 注释块至少两行
*/
/**
* @apiParamExample {json} 请求参数示例
* {
* "userName": "Eve"
* }
*/
https://apidocjs.com/
https://blog.csdn.net/qq_14824885/article/details/87793476
https://zhuanlan.zhihu.com/p/83487114
http://www.bjhee.com/apidoc.html