安裝: 必須先安裝node.js?
安裝完node.js, 打開命令行,執(zhí)行?npm install apidoc -g
安裝完成,在項(xiàng)目根目錄添加apidoc.json
內(nèi)容如下:
{
"name": "洗浴erp服務(wù)端",
? "description": "洗浴ERP服務(wù)端 接口說明",
? "title": "The title of this doc",
? "version": "1.0.1",
? "url": ""
}
添加注釋:
""" 上傳數(shù)據(jù)接口
@api {post} /upload/addbill 上傳結(jié)賬數(shù)據(jù)
@apiVersion 1.0.0
@apiGroup 數(shù)據(jù)上傳
@apiName addbill
@apiDescription 上傳結(jié)賬數(shù)據(jù),包含結(jié)賬單、消費(fèi)明細(xì),支付明細(xì),技師上鐘信息
@apiParam {string}? ? shopid? 店鋪標(biāo)識(shí)
@apiParam {json}? ? ? billinfo? 結(jié)賬單
@apiParam {json}? ? ? billdetail? 賬單明細(xì)
@apiParam {json}? ? ? paylist? 支付明細(xì)
@apiParam {json}? ? ? techlist? 技師數(shù)據(jù)
@apiParamExample {json} 參數(shù)格式:
@apiError {int}? ? code 0
@apiError {string}? msg? ""
@apiError {string}? ? data "錯(cuò)誤信息"
@apiErrorExample {json} 成功時(shí)的返回?cái)?shù)據(jù):
{
"code": 0,
"msg": "error",
"data": "錯(cuò)誤信息"
}
? """
在cmd 執(zhí)行命令:apidoc -i? 項(xiàng)目目錄/ -o 生成的文件目錄/
說明:生成的文件目錄,如果不存在,會(huì)自動(dòng)創(chuàng)建.