1 npm install apidoc -g
2 apidoc -h
3 新建 apidoc.json
{
"name": "demo",
"version": "1.0.0",
"description": apidoc demo",
"title": "demo",
"url" : "https://api.github.com/v1"
}
4 public 下新建apidoc文件夹
5 apidoc -i app -o public/apidoc
---------------------
apidoc : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\apidoc.ps1,因为在此系统上禁止运行脚本。有关详细信息,
解决方法:set-ExecutionPolicy RemoteSigned
----------
注释书写格式:
/**
* @api {get} /user/:id Request User information
* @apiName GetUser
* @apiGroup User
*
* @apiParam {Number} id Users unique ID.
*
* @apiSuccess {String} firstname Firstname of the User.
* @apiSuccess {String} lastname Lastname of the User.
*/