{"_id":"@bodonkey/apostrophecms-route-lister","name":"@bodonkey/apostrophecms-route-lister","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@bodonkey/apostrophecms-route-lister","version":"0.1.0","description":"ApostropheCMS task to list all Express routes (independent of any spec generator)","author":{"name":"BoDonkey","url":"Robert Means"},"type":"module","license":"MIT","main":"index.js","keywords":["apostrophecms","express","routes","api","openapi","documentation"],"repository":{"type":"git","url":"git+https://github.com/BoDonkey/apostrophecms-route-lister.git"},"bugs":{"url":"https://github.com/BoDonkey/apostrophecms-route-lister/issues"},"homepage":"https://github.com/BoDonkey/apostrophecms-route-lister#readme","engines":{"node":">=22.0.0"},"peerDependencies":{"apostrophe":">=4.0.0"},"_id":"@bodonkey/apostrophecms-route-lister@0.1.0","gitHead":"48a17daf14bf06e429e3d9dfc90de2fc8c2f9530","_nodeVersion":"22.14.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-cVi8TcCu4Hqlk0GkzVSsSzxDhQfT80cfG1A1QHLNcBFPTWdI7OK8a+zIB4k20QdPV0pOeJoTXHaFBQfxrPpUpA==","shasum":"7e6c2bd8b89d4f663c8a2e10fa6a2cf6c1591e4c","tarball":"https://registry.npmjs.org/@bodonkey/apostrophecms-route-lister/-/apostrophecms-route-lister-0.1.0.tgz","fileCount":4,"unpackedSize":13161,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC/HhmQo5I2Csx279uwmnEhNYgiMS/idf0pr5o9p12v0wIhAPBvK0IBDTyeD+K+jxD6NxKn2dI+RNEhtLYtUiKeBSBe"}]},"_npmUser":{"name":"bodonkey","email":"robert.means1969+apostrophecms@gmail.com"},"directories":{},"maintainers":[{"name":"bodonkey","email":"robert.means1969+apostrophecms@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/apostrophecms-route-lister_0.1.0_1755347668627_0.24633609050494876"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-16T12:34:28.551Z","0.1.0":"2025-08-16T12:34:28.917Z","modified":"2025-08-16T12:34:29.172Z"},"maintainers":[{"name":"bodonkey","email":"robert.means1969+apostrophecms@gmail.com"}],"description":"ApostropheCMS task to list all Express routes (independent of any spec generator)","homepage":"https://github.com/BoDonkey/apostrophecms-route-lister#readme","keywords":["apostrophecms","express","routes","api","openapi","documentation"],"repository":{"type":"git","url":"git+https://github.com/BoDonkey/apostrophecms-route-lister.git"},"author":{"name":"BoDonkey","url":"Robert Means"},"bugs":{"url":"https://github.com/BoDonkey/apostrophecms-route-lister/issues"},"license":"MIT","readme":"# @bodonkey/apostrophecms-route-lister\n\nA powerful ApostropheCMS task extension for listing and analyzing all Express routes in your application. Perfect for debugging, documentation, or generating OpenAPI specifications.\n\n## Features\n\n- 🔍 **List all routes** - Display all registered Express routes in a clean table format\n- 📤 **JSON export** - Dump routes as JSON for further processing or automation\n- 🎯 **Flexible filtering** - Include/exclude routes by path patterns or regex\n- 🔧 **Method filtering** - Filter by HTTP methods (GET, POST, etc.)\n- 🏗️ **Router-aware** - Properly handles mounted routers and nested routes\n- ✨ **Zero dependencies** - Lightweight and self-contained\n\n## Installation\n\n```bash\nnpm install @bodonkey/apostrophecms-route-lister\n```\n\n## Configuration\n\nAdd the extension to your ApostropheCMS project in `app.js`:\n\n```javascript\nexport default{\n  // other properties\n  modules: {\n    '@bodonkey/apostrophecms-route-lister': {}\n  }\n};\n```\n\n## Usage\n\n### List Routes (Table Format)\n\nDisplay all routes in a formatted table:\n\n```bash\nnode app @bodonkey/apostrophecms-route-lister:list-routes\n```\n\n#### Filtering Options\n\n### String Patterns\n- Simple string matching uses `startsWith()` logic\n- `/api` matches `/api/v1/users`, `/api/v1/pages`, etc.\n- `/customroute` matches `/customroute/xxx`, `/customroute/yyy`, etc.\n\n### Regex Patterns\n- Regex patterns must start with `/^` and end with `/` plus optional flags\n- `/^.*@apostrophecms.*/i` matches any route containing `@apostrophecms` (case-insensitive)\n- `/^\\/api\\/v[0-9]+/` matches `/api/v1`, `/api/v2`, etc.\n- `/^\\/users\\/[0-9]+$/` matches `/users/123` but not `/users/abc`\n\n**Include specific routes:**\n```bash\n# Include only API routes\nnode app @bodonkey/apostrophecms-route-lister:list-routes --include=/api\n\n# Include multiple patterns\nnode app @bodonkey/apostrophecms-route-lister:list-routes --include=/api,/admin\n\n# Use regex patterns\nnode app @bodonkey/apostrophecms-route-lister:list-routes --include=\"/^\\/api\\/v[0-9]+/\"\n```\n\n**Exclude routes:**\n```bash\n# Exclude routes containing @apostrophecms anywhere\nnode app @bodonkey/apostrophecms-route-lister:list-routes --exclude=\"/^.*@apostrophecms.*/\"\n\n# Exclude multiple patterns (mix of prefix and regex)\nnode app @bodonkey/apostrophecms-route-lister:list-routes --exclude=/@apostrophecms,\"/^.*internal.*/\"\n```\n\n**Filter by HTTP methods:**\n```bash\n# Show only GET routes\nnode app @bodonkey/apostrophecms-route-lister:list-routes --methods=GET\n\n# Show GET and POST routes\nnode app @bodonkey/apostrophecms-route-lister:list-routes --methods=GET,POST\n```\n\n**Combined filtering:**\n```bash\nnode app @bodonkey/apostrophecms-route-lister:list-routes --include=/api --exclude=/api/internal --methods=GET,POST\n```\n\n### Export Routes (JSON Format)\n\nExport routes as JSON for automation or further processing:\n\n```bash\n# Print to stdout\nnode app @bodonkey/apostrophecms-route-lister:dump-routes\n\n# Save to file\nnode app @bodonkey/apostrophecms-route-lister:dump-routes --output=routes.json\n\n# With filtering\nnode app @bodonkey/apostrophecms-route-lister:dump-routes --include=/api --methods=GET,POST --output=api-routes.json\n```\n\n#### JSON Output Format\n\n```json\n{\n  \"count\": 42,\n  \"routes\": [\n    {\n      \"method\": \"GET\",\n      \"path\": \"/api/users\"\n    },\n    {\n      \"method\": \"POST\", \n      \"path\": \"/api/users\"\n    }\n  ]\n}\n```\n\n## Examples\n\n### Basic Route Listing\n```bash\n$ node app @bodonkey/apostrophecms-route-lister:list-routes\n\nMETHOD  PATH\n----------------\nGET     /\nGET     /api/pages\nPOST    /api/pages\nGET     /api/users/:id\nDELETE  /api/users/:id\n\n5 route(s).\n```\n\n### API Routes Only\n```bash\n$ node app @bodonkey/apostrophecms-route-lister:list-routes --include=/api --methods=GET\n\nMETHOD  PATH\n----------------\nGET     /api/v1/pages\nGET     /api/v1/users\nGET     /api/v1/users/:id\n\n3 route(s).\n```\n\n### Export for OpenAPI Generation\n```bash\n# Export API routes for spec generation\nnode app @bodonkey/apostrophecms-route-lister:dump-routes --include=/api --output=api-routes.json\n\n✅ Wrote 15 routes to api-routes.json\n```\n\n## Filter Syntax\n\n### String Patterns\n- Simple string matching uses `startsWith()` logic\n- `/api` matches `/api/users`, `/api/pages`, etc.\n- `/admin` matches `/admin/login`, `/admin/dashboard`, etc.\n\n### Regex Patterns  \n- Regex patterns must start with `/^` and end with `/` plus optional flags\n- `/^\\/api\\/v[0-9]+/i` matches `/api/v1`, `/api/v2` (case insensitive)\n- `/^\\/users\\/[0-9]+$/` matches `/users/123` but not `/users/abc`\n\n### Multiple Filters\n- Use comma separation: `--include=/api,/admin`\n- Multiple filters use OR logic (matches ANY pattern)\n- Combine include/exclude for precise control\n\n## Use Cases\n\n- **API Documentation** - Generate route lists for documentation\n- **OpenAPI Spec Generation** - Export routes as JSON for spec builders\n- **Debugging** - Identify route conflicts or unexpected registrations\n- **Security Audits** - Review all exposed endpoints\n- **Testing** - Validate route registration in CI/CD pipelines\n\n## Requirements\n\n- ApostropheCMS 4.0.0 or higher\n- Node.js 22+ (for ES modules support)\n\n## Contributing\n\nIssues and pull requests are welcome! Please visit the [GitHub repository](https://github.com/BoDonkey/apostrophecms-route-lister).\n\n## License\n\nMIT © BoDonkey (Robert Means)\n\n## Related Projects\n\nThis extension pairs perfectly with OpenAPI spec generators and API documentation tools.","readmeFilename":"README.md","_rev":"1-099aa1b2912ce717eac6c20f8cc427c7"}