fix(admin-service): 排除移动端API路由的全局前缀

移动端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 <noreply@anthropic.com>
This commit is contained in:
Developer 2025-12-02 21:50:04 -08:00
parent 8a57013596
commit 6f55dc3195
1 changed files with 8 additions and 3 deletions

View File

@ -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(