32 lines
881 B
TypeScript
32 lines
881 B
TypeScript
import { Controller, Get } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
|
|
|
|
@ApiTags('Health')
|
|
@Controller('health')
|
|
export class HealthController {
|
|
@Get()
|
|
@ApiOperation({ summary: '健康检查' })
|
|
@ApiResponse({ status: 200, description: '服务正常' })
|
|
check(): { status: string; service: string; timestamp: string } {
|
|
return {
|
|
status: 'ok',
|
|
service: 'referral-service',
|
|
timestamp: new Date().toISOString(),
|
|
};
|
|
}
|
|
|
|
@Get('ready')
|
|
@ApiOperation({ summary: '就绪检查' })
|
|
@ApiResponse({ status: 200, description: '服务就绪' })
|
|
ready(): { status: string } {
|
|
return { status: 'ready' };
|
|
}
|
|
|
|
@Get('live')
|
|
@ApiOperation({ summary: '存活检查' })
|
|
@ApiResponse({ status: 200, description: '服务存活' })
|
|
live(): { status: string } {
|
|
return { status: 'alive' };
|
|
}
|
|
}
|