feat(server): add tsoa to generate api swaggers

This commit is contained in:
dayjoy
2025-09-26 12:20:02 +08:00
parent 3ef3fcbff9
commit 9551f6aab9
11 changed files with 320 additions and 439 deletions

View File

@@ -0,0 +1,12 @@
import swaggerUi from 'swagger-ui-express';
import path from 'path';
export function RegisterTsoaRoutes(app: any) {
// Register tsoa routes - 动态导入以避免编译时错误
const { RegisterRoutes } = require('../routes/routes');
RegisterRoutes(app);
// Serve swagger documentation - 动态导入swagger文档
const swaggerDocument = require(path.join(__dirname, '../swagger.json'));
app.use('/v3/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
}