
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
egg-jianghu-api-doc
Advanced tools
江湖 API 文档生成插件 - 企业级 API 文档自动化解决方案
npm i egg-jianghu-api-doc --save
// {app_root}/config/plugin.js
exports.jianghuApiDoc = {
enable: true,
package: 'egg-jianghu-api-doc',
};
// {app_root}/config/config.default.js
exports.jianghuApiDoc = {
appName: '我的应用',
version: '1.0.0',
baseUrl: 'http://localhost:7001',
autoGenerate: true,
cache: {
enabled: true,
ttl: 3600000 // 1小时
},
logging: {
level: 'INFO',
retentionDays: 30
}
};
启动应用后,访问以下地址:
/{appId}/jianghu-api-doc/{appId}/jianghu-api-doc/manage/{appId}/public/apidoc/index.html# 访问生成接口
GET /{appId}/jianghu-api-doc/generate
# 强制重新生成
GET /{appId}/jianghu-api-doc/generate?force=true
运行综合演示脚本:
node demos/demo-comprehensive.js
运行单个功能演示:
# 增量生成演示
node demos/demo-incremental.js
# 搜索功能演示
node demos/demo-search.js
# Token 管理演示
node demos/demo-token-management.js
# 导出功能演示
node demos/demo-export-functionality.js
# 错误处理和日志演示
node demos/demo-error-handling-logging.js
更多演示说明请查看 demos/README.md
GET /{appId}/jianghu-api-doc/generate - 生成文档POST /{appId}/jianghu-api-doc/regenerate - 强制重新生成GET /{appId}/jianghu-api-doc/incremental/stats - 获取增量生成统计POST /{appId}/jianghu-api-doc/search - 搜索 API 文档GET /{appId}/jianghu-api-doc/search/suggestions - 获取搜索建议GET /{appId}/jianghu-api-doc/search/history - 获取搜索历史POST /{appId}/jianghu-api-doc/tokens - 添加 TokenGET /{appId}/jianghu-api-doc/tokens - 获取 Token 列表PUT /{appId}/jianghu-api-doc/tokens/:id - 更新 TokenDELETE /{appId}/jianghu-api-doc/tokens/:id - 删除 TokenPOST /{appId}/jianghu-api-doc/environments - 添加环境GET /{appId}/jianghu-api-doc/environments - 获取环境列表POST /{appId}/jianghu-api-doc/environments/:name/test - 测试环境连接POST /{appId}/jianghu-api-doc/export - 导出文档POST /{appId}/jianghu-api-doc/export/batch - 批量导出GET /{appId}/jianghu-api-doc/export/history - 获取导出历史GET /{appId}/jianghu-api-doc/status - 获取系统状态GET /{appId}/jianghu-api-doc/cache/stats - 获取缓存统计DELETE /{appId}/jianghu-api-doc/cache - 清理缓存┌─────────────────────────────────────────────────────────────┐
│ 江湖 API 文档插件 │
├─────────────────────────────────────────────────────────────┤
│ Controller Layer (路由和请求处理) │
├─────────────────────────────────────────────────────────────┤
│ Service Layer (业务逻辑) │
│ ├── IncrementalGenerator (增量生成器) │
│ ├── CacheManager (缓存管理器) │
│ ├── SearchEngine (搜索引擎) │
│ ├── TokenManager (Token管理器) │
│ ├── EnvironmentManager (环境管理器) │
│ ├── ExportManager (导出管理器) │
│ ├── ErrorHandler (错误处理器) │
│ └── LogManager (日志管理器) │
├─────────────────────────────────────────────────────────────┤
│ Storage Layer (存储层) │
│ ├── File System (文件系统) │
│ ├── Memory Cache (内存缓存) │
│ └── Encrypted Storage (加密存储) │
└─────────────────────────────────────────────────────────────┘
egg-jianghu-api-doc/
├── app/
│ ├── controller/jianghuApiDoc.js # 控制器
│ ├── service/jianghuApiDoc.js # 主服务
│ ├── service/jianghuApiDoc/ # 子模块
│ └── router.js # 路由配置
├── config/
│ └── config.default.js # 默认配置
├── docs/ # 项目文档
│ ├── README.md # 文档目录
│ ├── FAQ.md # 常见问题
│ ├── OPTIMIZATION_COMPLETE.md # 项目总结
│ └── *SUMMARY.md # 功能说明文档
├── demos/ # 功能演示脚本
│ ├── README.md # 演示说明
│ ├── demo-comprehensive.js # 综合演示
│ └── demo-*.js # 单功能演示
├── example/ # 示例应用
├── openspec/ # OpenSpec 变更提案
└── README.md # 项目说明
添加新的导出格式:
// 在 ExportManager 中添加新的格式处理器
async exportCustomFormat(swaggerSpec, options) {
// 实现自定义格式导出逻辑
}
自定义错误类型:
// 在 ErrorHandler 中添加新的错误类型
this.errorTypes.CUSTOM_ERROR = 'CUSTOM_ERROR';
扩展搜索功能:
// 在 SearchEngine 中添加自定义搜索逻辑
async customSearch(query, options) {
// 实现自定义搜索逻辑
}
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
如果您遇到问题或有建议,请:
江湖 API 文档插件 - 让 API 文档生成更简单、更高效、更安全!
FAQs
江湖 API 文档插件 - 企业级 API 文档自动化解决方案
We found that egg-jianghu-api-doc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.