feat(backoffice): add status endpoint at root and move swagger to /docs

This commit is contained in:
Tiago Yamamoto 2025-12-24 00:11:18 -03:00
parent ae7003d3fa
commit 6a1bdefc4b
4 changed files with 16 additions and 7 deletions

View file

@ -8,7 +8,7 @@ BACKOFFICE_HOST=0.0.0.0
NODE_ENV=development NODE_ENV=development
# CORS Origins (comma-separated) # CORS Origins (comma-separated)
CORS_ORIGINS=https://gohorsejobs.com,https://gohorsejobs-dev.appwrite.network,https://api-dev2.gohorsejobs.com CORS_ORIGINS=http://localhost:3000,http://localhost:8963
# ============================================================================= # =============================================================================
# Stripe # Stripe

View file

@ -1,12 +1,15 @@
import { Controller, Get } from '@nestjs/common'; import { Controller, Get } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { AppService } from './app.service'; import { AppService } from './app.service';
@ApiTags('Root')
@Controller() @Controller()
export class AppController { export class AppController {
constructor(private readonly appService: AppService) {} constructor(private readonly appService: AppService) { }
@Get() @Get()
getHello(): string { @ApiOperation({ summary: 'API Status' })
return this.appService.getHello(); getStatus() {
return this.appService.getStatus();
} }
} }

View file

@ -2,7 +2,13 @@ import { Injectable } from '@nestjs/common';
@Injectable() @Injectable()
export class AppService { export class AppService {
getHello(): string { getStatus() {
return 'Hello World!'; return {
message: '🐴 GoHorseJobs Backoffice API is running!',
docs: '/docs',
health: '/health',
version: '1.0.0',
env: process.env.NODE_ENV || 'development',
};
} }
} }

View file

@ -79,7 +79,7 @@ async function bootstrap() {
.addBearerAuth() .addBearerAuth()
.build(); .build();
SwaggerModule.setup('api/docs', app, SwaggerModule.createDocument(app, config)); SwaggerModule.setup('docs', app, SwaggerModule.createDocument(app, config));
// Health check endpoint // Health check endpoint
const fastifyInstance = app.getHttpAdapter().getInstance(); const fastifyInstance = app.getHttpAdapter().getInstance();