APIDoc-MD
Generate API documentation for your README from comments in your
source-code. Uses apiDoc.
Usage
- add comments of the following format to routes in your codebase:
function myAwesomeHandler() {}
- rename your README.md to README.md.mustache
- add the following template code to README.md.mustache
{{#each api}}
## {{@key}}
{{#each this}}
### {{type}} {{url}}
{{title}}
{{#each parameters}}
{{#if @first}}**Parameters**
{{/if}}
* **<{{{type}}}> {{field}}:** {{{description}}}
{{#if @last}}
{{/if}}
{{/each}}
{{#each success}}
{{#if @first}}**Response**
{{/if}}
* **<{{{type}}}> {{field}}:** {{{description}}}
{{#if @last}}
{{/if}}
{{/each}}
{{#each error}}
{{#if @first}}**Error**
{{/if}}
* **{{field}}:** {{{description}}}
{{#if @last}}
{{/if}}
{{/each}}
{{/each}}
{{/each}}
- add a script to your package.json that looks something like this.
{
"scripts": {
"build-docs": "apidoc-md generate"
}
}