@vnphu/nestjs-api-explorer 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +47 -5
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@ An in-app API explorer for NestJS — like Postman, but embedded directly into y
5
5
  ## Features
6
6
 
7
7
  - **Route auto-discovery** — scans the live Express router, no decorators needed
8
- - **Markdown docs** — document body fields, query params, headers, and responses in a simple `.md` file
8
+ - **Markdown docs** — document body fields, query params, headers, and responses in a simple `.md` file or a folder of `.md` files
9
9
  - **Full request builder** — path params, query params, headers, auth, and body
10
10
  - **Global auth** — set Bearer Token / Basic Auth / API Key once, applies to all requests
11
11
  - **Body types** — JSON (with formatter), Form-encoded, Plain text
@@ -42,9 +42,44 @@ Open your browser at `http://localhost:3000/api-explorer`.
42
42
 
43
43
  ---
44
44
 
45
- ## Documenting your API (Markdown file)
45
+ ## Documenting your API (Markdown)
46
46
 
47
- Create a file `api-explorer.md` in your project root (or anywhere just set `docsFile` to the path).
47
+ ### Option ASingle file
48
+
49
+ Point `docsFile` to a `.md` file anywhere in your project:
50
+
51
+ ```typescript
52
+ ApiExplorerModule.register({
53
+ docsFile: './api-explorer.md',
54
+ })
55
+ ```
56
+
57
+ ### Option B — Folder of files
58
+
59
+ Point `docsFolder` to a directory. All `.md` files inside (including subfolders) are scanned and merged automatically:
60
+
61
+ ```typescript
62
+ ApiExplorerModule.register({
63
+ docsFolder: './docs',
64
+ })
65
+ ```
66
+
67
+ Example folder structure:
68
+
69
+ ```
70
+ docs/
71
+ ├── auth.md
72
+ ├── users.md
73
+ └── shop/
74
+ ├── products.md
75
+ └── orders.md
76
+ ```
77
+
78
+ Each file follows the same markdown syntax. Routes from all files are merged into one map. If two files define the same `METHOD /path`, the last file read wins.
79
+
80
+ ---
81
+
82
+ ### Full example
48
83
 
49
84
  ### Full example
50
85
 
@@ -366,11 +401,17 @@ ApiExplorerModule.register({
366
401
  // Default: 'API Explorer'
367
402
  title: 'My API — Explorer',
368
403
 
369
- // Path to the markdown docs file
404
+ // Path to a single markdown docs file
370
405
  // Relative paths are resolved from process.cwd()
371
- // Default: null (no docs, routes still shown without documentation)
406
+ // Default: null
372
407
  docsFile: './api-explorer.md',
373
408
 
409
+ // Path to a folder of markdown docs files (scanned recursively)
410
+ // All .md files found are merged together
411
+ // If both docsFile and docsFolder are set, docsFolder takes priority
412
+ // Default: null
413
+ docsFolder: './docs',
414
+
374
415
  // Explicitly enable or disable
375
416
  // The explorer is ALWAYS disabled when NODE_ENV === 'production'
376
417
  // Default: true
@@ -436,6 +477,7 @@ import {
436
477
  RouteInfo,
437
478
  DocField,
438
479
  parseDocsFile,
480
+ parseDocsFolder,
439
481
  } from '@vnphu/nestjs-api-explorer';
440
482
 
441
483
  // DocField — one field in body/query/params/headers/response
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnphu/nestjs-api-explorer",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "An in-app API explorer for NestJS — like Postman, but built right into your app.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",