apiDoc的安装
npm install apidoc -g
生成api的终端命令:apidoc -i 代码所在路径-o 生成文件的路径
接口文档的编写
文件的简介
project的介绍写在单独的json文件中apidoc.json:
{ "name": "project_name",
"version": "0.1.0",
"description": "who am i ,what i can do ",
"title": " title of the html that generated by apiDoc",
"sampleUrl" : "https://127.0.0.1:8000"}
具体api的书写模版
"""
@api {methods} url description
@apiName unique_name
@apiGroup group
@apiParam {type} field description
@apiSuccessExample {json} Success-Response:
HTTP/1.1 200 OK
{
"errno":200,
"errmsg":errmsg,
}
@apiError errortype description.
@apiErrorExample {json} Error-Response:
HTTP/1.1 200 OK
{
"errno":401
"errmsg": "UserNotFound"
}
"""
以上这篇使用apiDoc实现python接口文档编写就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持python博客。