Files
bps/backend/src/config/swagger.ts
T
2025-05-04 20:37:40 +08:00

37 lines
829 B
TypeScript

import swaggerJsdoc from 'swagger-jsdoc';
const options: swaggerJsdoc.Options = {
definition: {
openapi: '3.0.0',
info: {
title: '百盘搜 API 文档',
version: '1.0.0',
description: '百盘搜系统的API接口文档',
contact: {
name: 'API Support',
email: 'support@example.com'
}
},
servers: [
{
url: 'http://localhost:3005',
description: '开发服务器'
}
],
components: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT'
}
}
},
security: [{
bearerAuth: []
}]
},
apis: ['./src/routes/*.ts', './src/controllers/*.ts'] // 指定API注释文件的位置
};
export const swaggerSpec = swaggerJsdoc(options);