数据层可插拔(SQLite/MariaDB) + 后端 services 骨架

- database.ts 改为按 DB_TYPE 切换 SQLite / MariaDB(mysql2),sqlite3 按需动态导入
- index.ts 改为初始化数据库后再监听端口
- 新增 AuthService / HealthService / AnalysisService / GarminService
- 新增 .gitignore、server/.env(忽略) 与 .env.example
- README 增加数据库配置说明;package.json 增加 mysql2/@types
This commit is contained in:
ericwyuan
2026-08-23 11:58:07 +08:00
parent d73405decb
commit 6b05d04773
11 changed files with 22362 additions and 122 deletions

View File

@@ -14,6 +14,7 @@
"express": "^4.18.2",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"mysql2": "^3.6.0",
"sqlite3": "^5.1.6",
"jsonwebtoken": "^9.0.2",
"axios": "^1.5.0",
@@ -21,8 +22,10 @@
},
"devDependencies": {
"@types/express": "^4.17.17",
"@types/cors": "^2.8.13",
"@types/node": "^20.3.1",
"@types/jsonwebtoken": "^9.0.2",
"@types/sqlite3": "^3.1.8",
"typescript": "^5.1.3",
"tsx": "^3.12.7"
}