Files
frontend/API连接说明.md
2025-10-15 22:16:11 +08:00

41 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# API后端连接说明
## 配置已完成
✅ 已将前端项目配置为连接到您提供的API后端服务
- **API后端地址**: `https://code.littlelan.cn/CarrotSkin/APIgateway`
## 配置详情
环境变量已在 `.env.local` 文件中更新:
```
NEXT_PUBLIC_API_URL=https://code.littlelan.cn/CarrotSkin/APIgateway
```
## 如何测试连接
1. 确保开发服务器正在运行:
```bash
npm run dev
```
2. 访问应用并尝试登录或上传皮肤等功能系统将自动连接到配置的API后端。
3. 前端项目中的主要API调用位于
- `src/lib/api/actions.ts` - 包含登录、注册等用户操作
- `src/lib/api/auth.ts` - 包含认证相关配置
## 注意事项
- **CORS配置**: 请确保您的API后端已正确配置CORS允许来自前端域名的请求
- **API路径映射**: 前端默认会在API URL后添加相应端点例如登录API路径为 `/auth/login`
- **环境变量**: `.env.local` 文件不会被Git跟踪如需在其他环境部署请确保复制此配置
- **开发调试**: 您可以在浏览器控制台查看API调用情况以便调试连接问题
## 测试账号
前端项目内置了测试账号功能(用于开发环境):
- 用户名: `test`
- 密码: `test`
如果您希望禁用测试账号功能,请修改 `src/lib/api/actions.ts` 和 `src/lib/api/auth.ts` 文件中的相关代码。