Skip to content

okirmio-create/api-doc-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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-cli

Usage

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-file

Supported 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

About

# api-doc-cli

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors