first commit
This commit is contained in:
76
AIEC-server/README.md
Normal file
76
AIEC-server/README.md
Normal file
@ -0,0 +1,76 @@
|
||||
# Yundage-Backserver 测试项目
|
||||
|
||||
这是一个将Yundage前端与Spring Boot后端(backserver)集成的测试项目。
|
||||
|
||||
## 项目说明
|
||||
|
||||
本项目将原本使用Node.js后端的Yundage前端应用修改为连接Spring Boot后端。
|
||||
|
||||
## 主要修改
|
||||
|
||||
### 1. API基础URL修改
|
||||
- 原始:`http://localhost:3000/api`
|
||||
- 修改后:`http://localhost:8080/api`
|
||||
|
||||
### 2. API路径调整
|
||||
- 获取用户信息:`/api/user/me` → `/api/users/me`
|
||||
|
||||
### 3. 响应格式适配
|
||||
Spring Boot后端直接返回数据对象,而不是包装在`data`字段中:
|
||||
|
||||
#### Node.js响应格式:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"token": "xxx",
|
||||
"user": {...}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Spring Boot响应格式:
|
||||
```json
|
||||
{
|
||||
"token": "xxx",
|
||||
"id": 1,
|
||||
"username": "user",
|
||||
"email": "user@example.com",
|
||||
"phone": "13800138000"
|
||||
}
|
||||
```
|
||||
|
||||
### 4. 错误处理
|
||||
错误响应使用`error`字段而不是`message`字段:
|
||||
```json
|
||||
{
|
||||
"error": "错误信息"
|
||||
}
|
||||
```
|
||||
|
||||
## 使用说明
|
||||
|
||||
### 前置条件
|
||||
1. 启动Spring Boot后端服务(端口8080)
|
||||
2. 确保MySQL数据库已配置并运行
|
||||
|
||||
### 启动步骤
|
||||
1. 在浏览器中打开 `index.html`
|
||||
2. 或使用任何静态文件服务器提供文件服务
|
||||
|
||||
### 注意事项
|
||||
1. Spring Boot后端需要实现以下API:
|
||||
- POST `/api/auth/send-code` - 发送验证码
|
||||
- POST `/api/auth/login` - 用户登录
|
||||
- POST `/api/auth/register` - 用户注册
|
||||
- POST `/api/auth/logout` - 用户登出
|
||||
- POST `/api/auth/refresh` - 刷新Token
|
||||
- GET `/api/users/me` - 获取当前用户信息
|
||||
|
||||
2. 前端保持原有业务逻辑不变,仅调整API调用部分
|
||||
|
||||
## 待完成功能
|
||||
- 聊天功能API对接(需要在Spring Boot后端实现)
|
||||
- 用户资料更新API对接
|
||||
- 搜索和统计功能API对接
|
||||
Reference in New Issue
Block a user