First, what APIDOC that?
Simple popular point that, apidoc is a tool to automatically generate API interface documentation. It supports multi-lingual interface documentation generation, such as C #, Java, JavaScript, PHP , Python , etc. For details, please refer to the official documentation . java code can be implemented by apidoc annotations.
Two, APIDOC installation
1. Because apidoc node.js depends on, so you must first install node.js
2. Install apidoc
cmd to open the Run command box, enter the command npm install -g apidoc to install.
Use the command apidoc -h verify that the installation was successful.
Three, APIDOC use
1. Configure apidoc.json
Apidoc.json file is created in the project, project location is recommended in the root directory (src directory same level), you can also select.
apidoc.json example of the contents as follows:
1 { 2 "name": "Project Name" , 3 "Version": "Project Versions" , 4 "the Description": "Project Description" , 5 "title": "browser title" , 6 "url": "API prefix before the path, the path is automatically spliced to @api may be set to the empty string " 7 }
Specific configuration parameter names and their meanings refer to official documents
2. The interface adds apidoc comment
Specific configuration parameter names and their meanings refer to official documents
3. Generate interface documentation
Run command box open cmd, cd to the directory apidoc.json using apidoc -i src / -o apidoc / generate an HTML document format of the interface
Command Parameter Details List:
parameter | description |
-h, --help | Our help documentation |
-f --file-filters | Filename filter specified read the file regular expression (can specify more than one) such as: apidoc -f - "* \ js & quot; -f & quot; * ts & quot;; -f & quot * \\ ts......" f ".. * ts" means only reads js suffix ts files and the default value: .clj .cls .coffee .cpp .cs .dart .erl .exs .go .groovy .ino .java??. js .jsx .kt .litcoffee lua .p .php? .pl .pm .py .rb .scala .ts .vue |
-e --exclude-filters | Do not read the specified file name filtering regular expressions (can specify more than one) such as: apidoc -e ".. * \ Js $" means not read the file js suffix Default: '' |
-i, --input | Directory specified source file is read, for example: apidoc -i myapp / read means myapp / source file directory Default: ./ |
-o, --output | Specify the output directory documents such as: apidoc -o doc / output means to document doc directory defaults: ./ doc / |
-t, --template | Template file specifies the output example: apidoc -t mytemplate / Default: path.join (__ dirname, '... / template /') (default template) |
-c, --config | Specify the directory that contains configuration files (apidoc.json), for example: apidoc -c config / default: ./ |
-p, --private | Whether the output document contains proprietary api example: apidoc -p true Default: false |
-v, --verbose | Details of whether output debug information such as: apidoc -v true Default: false |