feat(backoffice): add root route with api info and correct swagger link

This commit is contained in:
Tiago Yamamoto 2025-12-27 01:03:01 -03:00
parent 469c473c1e
commit 7b3b909296
3 changed files with 24 additions and 2 deletions

View file

@ -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' };
}
}

View file

@ -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 { }

View file

@ -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
}