feat(backoffice): standardize root response root json format
This commit is contained in:
parent
caede0cfc7
commit
fee83f52f6
2 changed files with 8 additions and 6 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Controller, Get } from '@nestjs/common';
|
||||
import { Controller, Get, Req } from '@nestjs/common';
|
||||
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ export class AppController {
|
|||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'API Status' })
|
||||
getStatus() {
|
||||
return this.appService.getStatus();
|
||||
getStatus(@Req() req: any) {
|
||||
return this.appService.getStatus(req);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,15 @@ import { Injectable } from '@nestjs/common';
|
|||
|
||||
@Injectable()
|
||||
export class AppService {
|
||||
getStatus() {
|
||||
getStatus(req: any) {
|
||||
const ip = req.headers['x-forwarded-for'] || req.socket?.remoteAddress || req.ip;
|
||||
|
||||
return {
|
||||
message: '🐴 GoHorseJobs Backoffice API is running!',
|
||||
docs: '/docs',
|
||||
health: '/health',
|
||||
ip: ip ? ip.split(',')[0].trim() : 'unknown',
|
||||
message: '🐴 GoHorseJobs API is running!',
|
||||
version: '1.0.0',
|
||||
env: process.env.NODE_ENV || 'development',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue