Files
dashboard/.qoder/repowiki/knowledge/zh/音频设备管理全栈平台/音频设备管理后端 API/架构设计.md
T
2026-07-09 10:33:19 +08:00

5 lines
851 B
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.
- **分层架构**:采用经典的 MVC 模式,`routes/` 处理 HTTP 请求与响应,`models/` (Sequelize) 定义数据模型,`services/` 封装外部存储(S3, Redis)和业务逻辑。
- **入口与初始化**`src/app.js` 为应用入口,负责加载环境变量、同步数据库表结构 (`sequelize.sync()`) 并引导创建超级管理员 (`userBootstrap`)。
- **路由组织**`src/routes/index.js` 汇总所有业务路由(auth, brands, models, ota 等),通过 Express 中间件机制挂载。
- **认证机制**`middleware/auth.js` 实现基于 JWT 的身份验证,支持普通用户登录与超级管理员权限校验 (`requireSuperAdmin`)。
- **外部集成**:通过 `services/` 目录下的模块与 AWS S3 (文件存储)、Redis (EQ 缓存)、Meilisearch (搜索索引) 及远程曲线服务进行交互。