From 6a1bdefc4b7803faa9b4962062ecd3c77492a702 Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Wed, 24 Dec 2025 00:11:18 -0300 Subject: [PATCH] feat(backoffice): add status endpoint at root and move swagger to /docs --- backoffice/.env.example | 2 +- backoffice/src/app.controller.ts | 9 ++++++--- backoffice/src/app.service.ts | 10 ++++++++-- backoffice/src/main.ts | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/backoffice/.env.example b/backoffice/.env.example index 78df283..32649c7 100644 --- a/backoffice/.env.example +++ b/backoffice/.env.example @@ -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 diff --git a/backoffice/src/app.controller.ts b/backoffice/src/app.controller.ts index cce879e..e28e058 100644 --- a/backoffice/src/app.controller.ts +++ b/backoffice/src/app.controller.ts @@ -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(); } } diff --git a/backoffice/src/app.service.ts b/backoffice/src/app.service.ts index 927d7cc..7a2e73e 100644 --- a/backoffice/src/app.service.ts +++ b/backoffice/src/app.service.ts @@ -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', + }; } } diff --git a/backoffice/src/main.ts b/backoffice/src/main.ts index 1b7c1f8..3736770 100644 --- a/backoffice/src/main.ts +++ b/backoffice/src/main.ts @@ -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();