This commit is contained in:
hailin 2025-11-24 03:35:26 -08:00
parent 9e854c3888
commit 0340d068e7
3 changed files with 21 additions and 2 deletions

View File

@ -51,7 +51,7 @@ check_service "Identity Service" "curl -f http://localhost:3000/health" "npm run
# 检查 Swagger 文档
echo -e "${YELLOW}=== API 文档 ===${NC}"
check_service "Swagger UI" "curl -f http://localhost:3000/api" "等待 Identity Service 启动"
check_service "Swagger UI" "curl -f http://localhost:3000/api/docs" "等待 Identity Service 启动"
echo ""
echo -e "${YELLOW}======================================${NC}"

View File

@ -0,0 +1,18 @@
import { Controller, Get } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { Public } from '@/shared/decorators/public.decorator';
@ApiTags('健康检查')
@Controller()
export class HealthController {
@Public()
@Get('health')
@ApiOperation({ summary: '健康检查端点' })
health() {
return {
status: 'ok',
timestamp: new Date().toISOString(),
service: 'identity-service',
};
}
}

View File

@ -8,6 +8,7 @@ import { appConfig, databaseConfig, jwtConfig, redisConfig, kafkaConfig, smsConf
// Controllers
import { UserAccountController } from '@/api/controllers/user-account.controller';
import { HealthController } from '@/api/controllers/health.controller';
// Application Services
import { UserApplicationService } from '@/application/services/user-application.service';
@ -67,7 +68,7 @@ export class ApplicationModule {}
// ============ API Module ============
@Module({
imports: [ApplicationModule],
controllers: [UserAccountController],
controllers: [HealthController, UserAccountController],
})
export class ApiModule {}