使用apidocJs快速生成在线文档

https://blog.csdn.net/xialei199023/article/details/63251482

 

https://blog.csdn.net/qq_16142851/article/details/78319768?locationNum=1&fps=1

 

对比下面的两个例子,对apidoc的文档参数就有个基本认识了

例子 01

/**
* @api {get} index.php?i=  测试一
* @apiGroup test
* @apiVersion 0.0.1 * @apiDescription 这是第一个测试 * @apiParam {String} token 登录token * @apiParamExample 请求样例 * /index.php?i=8888 * @apiSuccess {int} type 类型 0:上行 1:下行 * @apiExample 请求成功数据 * { * "status": "1", * "data": { * "first": 1, * "last": 3, * }, * "msg": "操作成功" * } * @apiExample {json} 失败返回样例: * {"code":"0","msg":"修改成功"} */
例子02
/**
    * @api {POST} /test/:id 测试二
    * @apiGroup test
    * @apiVersion 0.0.1
    * @apiDescription 这是第二个测试 * @apiParam {String} name 名字 * @apiParam {String} [phone] 手机 * @apiSuccess (Success) {String} msg 信息 * @apiSuccess (Success) {int} code 0 代表无错误 1代表有错误 * @apiError (Error) {String} msg 信息 * @apiError (Error) {String} m 信息 * @apiParamExample 请求样例 * /index.php?i=8888 * @apiSuccessExample {json} 返回样例 * {"code":"0","msg":"修改成功"} * @apiErrorExample {json} 失败返回样例 * {"code":"0","msg":"修改成功"} */

apidoc 文档参数详细说明

* @apiDeprecated [提示消息] //弃用标志 如果未指定[]里面内容{包括中括号},则下次不产生该接口,如果指定,则输出提示消息
* @api {POST} /test/:id 测试二 //指定接收方式以及显示名称
* @apiGroup //分组 * @apiVersion //版本 * @apiDescription //描述 * @apiParam {String} name 名字 // 参数类型 以及参数名称 没有中括号代表必选参数 * @apiParam {String} [phone] 手机 // 参数类型 以及参数名称 [phone] 代表可选参数 * @apiSuccess (Success) {String} msg 信息 //返回成功数据名称以及类型 * @apiError (Error) {String} msg 信息 //返回失败数据名称以及类型 * @apiParamExample 请求样例 //示例 * /index.php?i=8888 //例子 * @apiSuccessExample {json} 返回样例 // 返回成功数据以及指定返回数据格式 * {"code":"0","msg":"修改成功"} //指定json格式后可以不用格式化,apidoc 输出的时候会做做处理 * @apiErrorExample {json} 失败返回样例 // 返回失败数据以及指定返回数据格式 * {"code":"0","msg":"修改成功"}

tips

01: warn: Please create an apidoc.json configuration file.
检查你的项目下 有没有 apidoc.json  //没有则创建
{
  "name": "文档名称",
  "version": "0.1.0", //版本号 "description": "apiDoc basic example", // 描述 "title": "Custom apiDoc browser title", // 头部 "url" : "http://192.168.197.135/" // 项目地址 "sampleUrl" : "http://192.168.197.135/" //接口默认发送的地址 }
02:warn: parser plugin ‘param’ not found in block: 1
具体问题没有找到 下面的是我的做法
# rm -rf test/apidoc/*
# apidoc -i test/ -o test/apidoc/
-- 这样子就解决了!
03 :apidoc error: No files found. { Path: ‘/data/wwwroot’ }
应该是因为 nodejs版本太高 以及 npn版本太高的原因

转载于:https://www.cnblogs.com/mapu/p/9186282.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值