refactor: 重构项目结构并优化代码
- 删除无用的文件和错误日志 - 创建统一的 imports 模块集中管理依赖 - 重构组件使用新的 imports 方式 - 修复文档路径大小写问题 - 优化类型定义和接口导出 - 更新依赖版本 - 改进错误处理和API配置 - 统一组件导出方式
This commit is contained in:
39
server/src/simple-server.ts
Normal file
39
server/src/simple-server.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import express from 'express';
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3001;
|
||||
|
||||
// 中间件
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
// 健康检查接口
|
||||
app.get('/api/health', (req, res) => {
|
||||
res.json({ status: 'ok', message: 'Backend service is running' });
|
||||
});
|
||||
|
||||
// 模拟登录接口
|
||||
app.post('/api/auth/login', (req, res) => {
|
||||
const { username, password } = req.body;
|
||||
res.json({
|
||||
success: true,
|
||||
data: {
|
||||
token: 'mock-token-123',
|
||||
refreshToken: 'mock-refresh-token-123',
|
||||
user: {
|
||||
id: '1',
|
||||
username: username || 'admin',
|
||||
role: 'ADMIN',
|
||||
tenantId: 'default-tenant',
|
||||
shopId: 'default-shop'
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 启动服务器
|
||||
app.listen(PORT, () => {
|
||||
console.log(`简化后端服务运行在 http://localhost:${PORT}`);
|
||||
});
|
||||
|
||||
export default app;
|
||||
Reference in New Issue
Block a user