From 6f55dc3195cf890630f96ac54a33a9e8091d0fff Mon Sep 17 00:00:00 2001 From: Developer Date: Tue, 2 Dec 2025 21:50:04 -0800 Subject: [PATCH] =?UTF-8?q?fix(admin-service):=20=E6=8E=92=E9=99=A4?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AFAPI=E8=B7=AF=E7=94=B1=E7=9A=84?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移动端APP需要访问 /api/app/version/check,而不是 /api/v1/api/app/version/check 使用 setGlobalPrefix 的 exclude 选项排除移动端路由 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- backend/services/admin-service/src/main.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/services/admin-service/src/main.ts b/backend/services/admin-service/src/main.ts index c3fa02dc..7469966e 100644 --- a/backend/services/admin-service/src/main.ts +++ b/backend/services/admin-service/src/main.ts @@ -1,5 +1,5 @@ import { NestFactory } from '@nestjs/core' -import { ValidationPipe, Logger } from '@nestjs/common' +import { ValidationPipe, Logger, RequestMethod } from '@nestjs/common' import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger' import { AppModule } from './app.module' @@ -7,8 +7,13 @@ async function bootstrap() { const logger = new Logger('Bootstrap') const app = await NestFactory.create(AppModule) - // Global prefix - app.setGlobalPrefix('api/v1') + // Global prefix (exclude mobile API routes that need custom paths) + app.setGlobalPrefix('api/v1', { + exclude: [ + { path: 'api/app/version/(.*)', method: RequestMethod.ALL }, + { path: 'api/app/version/check', method: RequestMethod.GET }, + ], + }) // Validation app.useGlobalPipes(