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
# 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

View file

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

View file

@ -2,7 +2,13 @@ import { Injectable } from '@nestjs/common';
@Injectable()
export class AppService {
getHello(): string {
return 'Hello World!';
getStatus() {
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()
.build();
SwaggerModule.setup('api/docs', app, SwaggerModule.createDocument(app, config));
SwaggerModule.setup('docs', app, SwaggerModule.createDocument(app, config));
// Health check endpoint
const fastifyInstance = app.getHttpAdapter().getInstance();