23 lines
591 B
TypeScript
23 lines
591 B
TypeScript
import { Controller, Get, Res } from '@nestjs/common';
|
|
import type { Response } from 'express';
|
|
|
|
@Controller('health')
|
|
export class HealthController {
|
|
@Get()
|
|
getHealth(@Res() res: Response) {
|
|
const payload = {
|
|
status: 'ok',
|
|
timestamp: new Date().toISOString(),
|
|
service: 'crm-backend',
|
|
version:
|
|
process.env.APP_VERSION ?? process.env.npm_package_version ?? 'unknown',
|
|
uptimeSeconds: Math.floor(process.uptime()),
|
|
};
|
|
|
|
res
|
|
.status(200)
|
|
.type('application/json; charset=utf-8')
|
|
.send(`${JSON.stringify(payload)}\n`);
|
|
}
|
|
}
|