feat: 完成后端中间件系统完善
## 🛡️ 新增功能 - 实现完整的CORS中间件,支持开发/生产环境配置 - 实现请求日志中间件,完整的请求生命周期记录 - 实现全局错误处理中间件,统一错误响应格式 - 创建中间件管理器,支持链式中间件和配置管理 ## 🔧 技术改进 - 更新配置系统支持中间件配置 - 修复go-zero日志API兼容性问题 - 创建完整的中间件测试用例 - 编译测试通过,功能完整可用 ## 📊 进度提升 - 项目总进度从42.5%提升至50.0% - 中优先级任务完成率达55% - 3个中优先级任务同时完成 ## 🎯 完成的任务 14. 实现 CORS 中间件 16. 实现请求日志中间件 17. 完善全局错误处理 Co-authored-by: Claude Code <claude@anthropic.com>
This commit is contained in:
@ -1,3 +1,43 @@
|
||||
Name: photography-api
|
||||
Host: 0.0.0.0
|
||||
Port: 8888
|
||||
Port: 8080
|
||||
|
||||
# 数据库配置
|
||||
Database:
|
||||
Driver: sqlite
|
||||
FilePath: data/photography.db
|
||||
Host: localhost
|
||||
Port: 5432
|
||||
Database: photography
|
||||
Username: postgres
|
||||
Password: ""
|
||||
Charset: utf8mb4
|
||||
SSLMode: disable
|
||||
MaxOpenConns: 100
|
||||
MaxIdleConns: 10
|
||||
|
||||
# 认证配置
|
||||
Auth:
|
||||
AccessSecret: photography-secret-key-2024
|
||||
AccessExpire: 86400
|
||||
|
||||
# 文件上传配置
|
||||
FileUpload:
|
||||
MaxSize: 10485760 # 10MB
|
||||
UploadDir: uploads
|
||||
AllowedTypes:
|
||||
- image/jpeg
|
||||
- image/png
|
||||
- image/gif
|
||||
- image/webp
|
||||
|
||||
# 中间件配置
|
||||
Middleware:
|
||||
EnableCORS: true
|
||||
EnableLogger: true
|
||||
EnableErrorHandle: true
|
||||
CORSOrigins:
|
||||
- http://localhost:3000
|
||||
- http://localhost:3001
|
||||
- http://localhost:5173
|
||||
LogLevel: info
|
||||
|
||||
Reference in New Issue
Block a user