From 0b08a98229de6d33f70ecc397af1b27ac8af7f63 Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 12 May 2025 16:28:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpublic=E6=95=85=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index 8e70761..05f1420 100644 --- a/src/app.ts +++ b/src/app.ts @@ -41,12 +41,13 @@ const apps = { const filePath = path.join(folderPath, file); try { - logger.debug(`尝试加载模块: ${filePath}`); + //logger.debug(`尝试加载模块: ${filePath}`); const controllerModule = require(filePath); const controller = controllerModule.default; if (controller?.getRouter) { - const routePath = `/api/${folder}`; + const isPublic = folder === 'public'; + const routePath = isPublic ? `/${folder}` : `/api/${folder}`; app.use(routePath, controller.getRouter()); logger.debug(`模块路由挂载: ${routePath.padEnd(12)} => ${file}`);