2025-08-28 09:14:56 +08:00
|
|
|
const swaggerJsdoc = require('swagger-jsdoc');
|
|
|
|
|
|
|
|
|
|
// Swagger定义
|
|
|
|
|
const options = {
|
|
|
|
|
definition: {
|
|
|
|
|
openapi: '3.0.0',
|
|
|
|
|
info: {
|
|
|
|
|
title: '融豆商城 API',
|
|
|
|
|
version: '1.0.0',
|
|
|
|
|
description: '融豆商城后端API文档',
|
|
|
|
|
contact: {
|
|
|
|
|
name: '技术支持',
|
|
|
|
|
email: 'support@example.com'
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
servers: [
|
|
|
|
|
{
|
|
|
|
|
url: '/api',
|
|
|
|
|
description: 'API服务器'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
components: {
|
|
|
|
|
securitySchemes: {
|
|
|
|
|
bearerAuth: {
|
|
|
|
|
type: 'http',
|
|
|
|
|
scheme: 'bearer',
|
|
|
|
|
bearerFormat: 'JWT'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
security: [{
|
|
|
|
|
bearerAuth: []
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
// API文档扫描路径
|
2025-09-02 09:29:20 +08:00
|
|
|
apis: ['./docs/schemas/*.js', './docs/apis/*.js', './routes/*.js', './admin/routes/*.js'],
|
2025-08-28 09:14:56 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const specs = swaggerJsdoc(options);
|
|
|
|
|
|
|
|
|
|
module.exports = specs;
|