Files
BOSS/BOSSFrontEnd/openapi.config.ts

19 lines
546 B
TypeScript
Raw Normal View History

2026-01-10 21:55:01 +08:00
import { generateService } from '@umijs/openapi';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
// 获取当前文件目录
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// 生成 API 服务代码
generateService({
requestLibPath: "import request from '@/libs/request'",
schemaPath: 'http://localhost:8081/v3/api-docs',
2026-01-10 21:55:01 +08:00
serversPath: join(__dirname, 'src/api'),
mock: false,
}).catch((error) => {
console.error('API生成失败:', error);
process.exit(1);
});