From 57aff59b451af8b079a9e4efe24231080407b9e8 Mon Sep 17 00:00:00 2001 From: Kubbo <390378816@qq.com> Date: Sun, 19 Oct 2025 22:40:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(server):=20=E9=9B=86=E6=88=90=E9=9D=99?= =?UTF-8?q?=E6=80=81=E6=96=87=E4=BB=B6=E6=9C=8D=E5=8A=A1=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 koa-static 中间件以支持静态资源访问 - 更新 package.json 引入 nodemon 用于服务热重载- 调整项目结构,将前端代码移至 module/web 目录下 - 修改图片引用路径适配新目录结构 - 更新主入口文件引入路由模块的方式- 配置 Vite 构建工具替换原有构建方式- 移除 Turbo依赖并使用 concurrently 管理多进程开发任务- 更新根目录 package.json 的脚本命令指向新的开发启动逻辑 --- module/server/index.js | 4 ++- module/server/package.json | 7 ++-- index.html => module/web/index.html | 2 +- module/web/package.json | 17 +++++++-- {src => module/web/src}/App.vue | 0 {src => module/web/src}/assets/css/index.scss | 12 ------- .../web/src}/assets/css/layout.scss | 0 {src => module/web/src}/assets/vue.svg | 0 .../web/src}/components/loading.vue | 0 {src => module/web/src}/config.js | 0 {src => module/web/src}/main.js | 2 +- {src => module/web/src}/router/index.js | 0 {src => module/web/src}/style.css | 0 {src => module/web/src}/utils/index.js | 0 {src => module/web/src}/views/index.vue | 0 {src => module/web/src}/views/login.vue | 4 +-- vite.config.js => module/web/vite.config.js | 0 package.json | 36 +++++++------------ scripts/dev.js | 6 ++++ turbo.json | 9 ----- 20 files changed, 43 insertions(+), 56 deletions(-) rename index.html => module/web/index.html (93%) rename {src => module/web/src}/App.vue (100%) rename {src => module/web/src}/assets/css/index.scss (89%) rename {src => module/web/src}/assets/css/layout.scss (100%) rename {src => module/web/src}/assets/vue.svg (100%) rename {src => module/web/src}/components/loading.vue (100%) rename {src => module/web/src}/config.js (100%) rename {src => module/web/src}/main.js (94%) rename {src => module/web/src}/router/index.js (100%) rename {src => module/web/src}/style.css (100%) rename {src => module/web/src}/utils/index.js (100%) rename {src => module/web/src}/views/index.vue (100%) rename {src => module/web/src}/views/login.vue (94%) rename vite.config.js => module/web/vite.config.js (100%) create mode 100644 scripts/dev.js delete mode 100644 turbo.json diff --git a/module/server/index.js b/module/server/index.js index 27d17c4..852470e 100644 --- a/module/server/index.js +++ b/module/server/index.js @@ -1,6 +1,7 @@ import Koa from 'koa'; import Router from 'koa-router'; import config from "./config/index.js" +import koaStatic from 'koa-static'; const app = new Koa(); const router = new Router(); @@ -19,9 +20,10 @@ router.get('/api/config', (ctx) => { }) app.use(router.routes()); app.use(router.allowedMethods()); +app.use(koaStatic('/www')) const PORT = process.env.PORT || 3001; app.listen(PORT, () => { console.log(`Koa server is running on port ${PORT}`); -}); \ No newline at end of file +}); diff --git a/module/server/package.json b/module/server/package.json index 8dd043c..36eeb0a 100644 --- a/module/server/package.json +++ b/module/server/package.json @@ -6,10 +6,11 @@ "type": "module", "scripts": { "start": "node index.js", - "dev": "node index.js" + "dev": "nodemon index.js" }, "dependencies": { "koa": "^2.15.0", - "koa-router": "^12.0.0" + "koa-router": "^12.0.0", + "koa-static": "^5.0.0" } -} \ No newline at end of file +} diff --git a/index.html b/module/web/index.html similarity index 93% rename from index.html rename to module/web/index.html index f5e45f1..9e9d310 100644 --- a/index.html +++ b/module/web/index.html @@ -18,6 +18,6 @@
- +