feat(server): 重构服务端架构并集成MySQL数据库

- 添加MySQL数据库配置,包含主机地址、端口、用户名、密码和数据库名
- 创建独立的Koa服务器模块,包含路由配置和静态文件服务
- 实现MySQL连接池配置,支持命名占位符查询格式化
- 调整项目入口文件结构,分离MySQL和Koa服务模块
- 更新package.json配置,修改主入口文件并添加mysql2依赖
This commit is contained in:
2025-12-24 22:27:36 +08:00
parent 57aff59b45
commit 18600b3015
6 changed files with 59 additions and 32 deletions

View File

@@ -2,7 +2,7 @@
"name": "chuanqi-server",
"version": "1.0.0",
"description": "A simple Koa server for chuanqi web",
"main": "index.js",
"main": "koa/index.js",
"type": "module",
"scripts": {
"start": "node index.js",
@@ -11,6 +11,7 @@
"dependencies": {
"koa": "^2.15.0",
"koa-router": "^12.0.0",
"koa-static": "^5.0.0"
"koa-static": "^5.0.0",
"mysql2": "^3.16.0"
}
}