const express = require('express');
const dsxapi = require('./dsxapi/dsxapi');
const farmeworkapi = require('./farmeworkapi/farmeworkapi');

const app = express();

// 将原有后端挂载到根路径，保持前端 API_BASE_URL 兼容（直接以 / 开头）
app.use('/', farmeworkapi);

// 新后端挂载到 /dsxapi 前缀下，前端可通过 `${API_BASE_URL}/dsxapi/...` 调用
app.use('/dsxapi', dsxapi);

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Unified API server listening on http://localhost:${PORT}`);
});
