Skip to content

Instantly share code, notes, and snippets.

@tpai
Last active March 30, 2016 05:23
Show Gist options
  • Save tpai/2623969f6ddf1b0321f2 to your computer and use it in GitHub Desktop.
Save tpai/2623969f6ddf1b0321f2 to your computer and use it in GitHub Desktop.
ApidocJS snippet (http://apidocjs.com/)

CLI

apidoc -f ".*\\.js$" -i apisrc/ -o apidoc/

apidoc.json

{
  "name": "API Document",
  "version": "0.1.0",
  "description": "API Document for website development.",
  "apidoc": {
    "title": "API Document"
  },
  "template": {
    "forceLanguage": "en"
  }
}

Example

/**
 * @api {post} /member Add Member
 * @apiVersion 0.2.2
 * @apiName Add Member
 * @apiGroup Member
 * @apiPermission Admin
 *
 * @apiParam {String} account User Account
 * @apiParam {String} name User Name
 * @apiParam {String} email User Mail
 * @apiParamExample {json} Request
 *      {
 *          account: "johndoe",
 *          name: "johndoe",
 *          email: "[email protected]"
 *      }
 * @apiSuccess {Bool} success Result
 * @apiSuccessExample {json} Request
 *      {
 *          success: true
 *      }
 * @apiError {Bool} success Result
 * @apiErrorExample {json} Response
 *      {
 *          success: false
 *      }
 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment