Files
赵忠林 528fe28ffc feat(api): 添加多路由代理处理实现
- 新增api目录下多个接口路径代理处理文件,支持动态拼接目标URL
- 根据环境变量选择不同的后端服务地址(如dev和生产环境)
- 统一添加TenantId和Authorization请求头传递租户及身份信息
- 实现请求参数及搜索参数的完整转发
- 引入better-sqlite3及node内建模块支持服务端功能
- 新增专家详情页面,实现文章、成果及预约咨询功能展示
- 页面实现加载骨架屏、标签页切换及空状态提示优化体验
2026-04-28 13:50:27 +08:00

32 lines
1.0 KiB
JavaScript

import { d as defineEventHandler, u as useRuntimeConfig, a as getRouterParam, b as getRequestURL, c as getHeader, p as proxyRequest } from '../../../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import 'better-sqlite3';
function joinURL(base, path) {
if (!path) return base;
return base.replace(/\/+$/, "") + "/" + path.replace(/^\/+/, "");
}
const ____path_ = defineEventHandler((event) => {
const config = useRuntimeConfig();
const mpApiBase = config.public.mpApiBase || "https://mp-api.websoft.top";
const path = getRouterParam(event, "path") || "";
const search = getRequestURL(event).search;
const target = joinURL(mpApiBase + "/api/cms", path) + search;
const tenantId = getHeader(event, "tenantid") || config.public.tenantId;
return proxyRequest(event, target, {
headers: {
TenantId: String(tenantId)
}
});
});
export { ____path_ as default };
//# sourceMappingURL=_...path_.mjs.map