/** * Swagger配置文件 */ import swaggerJsdoc from 'swagger-jsdoc'; const options = { definition: { openapi: '3.0.0', info: { title: 'ERPTurbo_Poster API', version: '1.0.0', description: '海报和PDF生成服务API文档', }, servers: [ { url: 'http://localhost:3000', description: '开发服务器' } ], components: { securitySchemes: { ApiKeyAuth: { type: 'apiKey', in: 'header', name: 'X-API-Key', description: 'API密钥认证,也可以使用Bearer认证方式' } } } }, apis: ['./server.mjs', './lib/routes.js'], // 包含API注释的文件 }; const specs = swaggerJsdoc(options); export default specs;