• 使用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版本太高的原因
  • 相关阅读:
    asp.net 数据导出到Excel
    系统架构之畅想
    access2003绿色中文版(转)
    项目那点事(共享)
    不错的消息提示
    配置Windows media service 流媒体服务器
    MemberShip 数据库的安装,web.config的配置及数据库文档结构
    windows server 2003 service pack 2 无法安装...产品密钥可能无效
    残忍,人
    js小技巧鼠标滑过显示大图
  • 原文地址:https://www.cnblogs.com/mapu/p/9186282.html
Copyright © 2020-2023  润新知