api 生成接口文檔示例:
- {
- "name": "9月份贈(zèng)險(xiǎn)領(lǐng)取分享活動(dòng)微信接口",
- "version": "1.0.0",
- "description": "9月份贈(zèng)險(xiǎn)領(lǐng)取分享活動(dòng)微信接口文檔 (t=1) ",
- "sampleUrl" : "http://m.survivalescaperooms.com/"
- }
另存文件名為:apidoc.json
apidoc -i 要生成文檔的項(xiàng)目目錄 -o 接口文件的生成目錄
接口代碼文件代碼如下:
- /**
- * @api {post} /news/lists 新聞信息列表
- * @apiVersion 1.0.0
- * @apiName lists
- * @apiGroup User
- * @apiPermission 登錄用戶(hù)
- *
- * @apiDescription 用戶(hù)登錄后進(jìn)入該頁(yè)面,將顯示新聞信息列表
- *
- * @apiSampleRequest /v1/news/lists
- *
- * @apiSuccess (返回值) {string} id 主鍵ID
- * @apiSuccess (返回值) {string} name 客戶(hù)姓名
- * @apiSuccess (返回值) {string} user_head_img 客戶(hù)頭像
- * @apiSuccess (返回值) {integer} sex 性別:0-未設(shè)置,1-男,2-女
- * @apiSuccess (返回值) {string} demand 客戶(hù)需求
- *
- * @apiSuccessExample {json} 成功示例:
- * {"code": 1,"msg": "","data": {"id": "57b3cdb46b787","name": "余浩苗","user_head_img": "userHead/2016-08-18/1034587522576.jpg","sex": "1","demand": "本人想買(mǎi)保險(xiǎn),請(qǐng)速聯(lián)系!"}}
- *
- * @apiErrorExample (json) 錯(cuò)誤示例:
- * {"code":-1,"msg":"密碼錯(cuò)誤","data":{}}
- */
- ///////////////////////////////////////
- /**
- * @api {post} /news/rob 搶客戶(hù)
- * @apiVersion 1.0.0
- * @apiName rob
- * @apiGroup User
- * @apiPermission 登錄用戶(hù)
- *
- * @apiDescription 搶客戶(hù)
- *
- * @apiParam {string} id 主鍵ID
- *
- * @apiSampleRequest /v1/news/rob
- *
- * @apiSuccessExample {json} 成功示例:
- * {"code":1,"msg":"","data":{}}
- *
- * @apiErrorExample (json) 錯(cuò)誤示例:
- * {"code":-1,"msg":"錯(cuò)誤信息","data":{}}
- */
更多關(guān)于apidoc的用法請(qǐng)參考:http://apidocjs.com/
新聞熱點(diǎn)
疑難解答