@asdsadw12312dwd2112xz/api-doc-cli
v1.0.0
Published
Generate API documentation from Express/Fastify route files
Downloads
60
Maintainers
Readme
api-doc-cli
Generate API documentation from Express/Fastify route files.
Scans your source code for route definitions (app.get, router.post, fastify.delete, etc.), extracts HTTP methods, paths, and JSDoc descriptions, then outputs a Markdown or JSON document.
Install
npm install -g api-doc-cliUsage
api-doc [options]Options
| Flag | Description | Default |
|------|-------------|---------|
| -d, --dir <path> | Source directory to scan | . |
| -o, --output <file> | Output file path | API.md |
| -p, --pattern <glob> | Glob pattern for route files | **/*route*.{ts,js} |
| --json | Output as JSON instead of Markdown | |
| --group-by-file | Group endpoints by source file | |
Examples
# Scan current directory with defaults
api-doc
# Scan a specific directory
api-doc -d src/routes
# Custom pattern and output
api-doc -p "**/*.controller.ts" -o docs/endpoints.md
# JSON output grouped by file
api-doc --json --group-by-fileSupported Patterns
The tool detects route registrations on these objects:
app(Express)router(Express Router)server/fastify(Fastify)
HTTP methods: GET, POST, PUT, DELETE, PATCH.
JSDoc comments (/** ... */) directly above the route call are extracted as descriptions.
License
MIT
