From 7b3b9092963b344f20637805864521a3c7a86208 Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Sat, 27 Dec 2025 01:03:01 -0300 Subject: [PATCH] feat(backoffice): add root route with api info and correct swagger link --- backoffice/src/app.controller.ts | 19 +++++++++++++++++++ backoffice/src/app.module.ts | 5 ++++- start.sh | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 backoffice/src/app.controller.ts diff --git a/backoffice/src/app.controller.ts b/backoffice/src/app.controller.ts new file mode 100644 index 0000000..dd75d31 --- /dev/null +++ b/backoffice/src/app.controller.ts @@ -0,0 +1,19 @@ +import { Controller, Get } from '@nestjs/common'; + +@Controller() +export class AppController { + @Get() + getHealth() { + return { + message: '💊 SaveInMed Backoffice is running!', + docs: '/docs', + health: '/health', // Note: User requested this, but I need to make sure /health exists or this is just a static link. Usually NestJS has Terminus for health, or I can add a simple one. For now I will match the user request JSON structure. + version: '1.0.0', + }; + } + + @Get('health') // Adding health route just in case, or user implies it exists. I'll add a simple one. + checkHealth() { + return { status: 'ok' }; + } +} diff --git a/backoffice/src/app.module.ts b/backoffice/src/app.module.ts index 3e509cc..d16a23e 100644 --- a/backoffice/src/app.module.ts +++ b/backoffice/src/app.module.ts @@ -6,6 +6,8 @@ import { PrismaModule } from './prisma/prisma.module'; import { UsersModule } from './users/users.module'; import { WebhooksModule } from './webhooks/webhooks.module'; +import { AppController } from './app.controller'; + @Module({ imports: [ ConfigModule.forRoot({ isGlobal: true }), @@ -15,5 +17,6 @@ import { WebhooksModule } from './webhooks/webhooks.module'; InventoryModule, WebhooksModule, ], + controllers: [AppController], }) -export class AppModule {} +export class AppModule { } diff --git a/start.sh b/start.sh index bbf00cf..1351a6d 100755 --- a/start.sh +++ b/start.sh @@ -186,7 +186,7 @@ start_backoffice() { echo -e "${GREEN} ▶ Executando: $PKG_MANAGER run start:dev${NC}" echo -e "${CYAN} 📍 Backoffice disponível em: http://localhost:3000${NC}" - echo -e "${CYAN} 📚 Swagger: http://localhost:3000/api${NC}\n" + echo -e "${CYAN} 📚 Swagger: http://localhost:3000/docs${NC}\n" $PKG_MANAGER run start:dev }