From 56aa5f78a42cc8d38c1d35668502129b239afdd7 Mon Sep 17 00:00:00 2001 From: admin user Date: Wed, 10 Jun 2026 23:07:01 +0000 Subject: [PATCH] =?UTF-8?q?feat(welcome):=20p=C3=A1gina=20de=20bienvenida?= =?UTF-8?q?=20en=20/=20del=20Golden=20Path=20(shape=201.2.0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/app/main.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/code/app/main.py b/code/app/main.py index 0a9c916..88e164f 100644 --- a/code/app/main.py +++ b/code/app/main.py @@ -2,24 +2,28 @@ Aplicación FastAPI — entry point. Endpoints obligatorios del shape web-backend/python (ver coralware-shape.yaml): +- / → página de bienvenida (instrucciones de uso del tenant; tu código la reemplaza) - /health → liveness + readiness - /docs → Swagger UI (auth opcional) - /demo → frontend estático servido desde STATIC_DEMO_PATH - /metrics → Prometheus Endpoints de dominio: agregar en app/routers/ y registrar en _register_routers(). +La ruta raíz `/` sirve la página de bienvenida por defecto; en cuanto agregues tu +propio handler de `/` (o lo registres en app/routers/) tu desarrollo la reemplaza. """ import logging import os from fastapi import Depends, FastAPI, HTTPException, Request, status -from fastapi.responses import JSONResponse, Response +from fastapi.responses import HTMLResponse, JSONResponse, Response from fastapi.staticfiles import StaticFiles from prometheus_client import CONTENT_TYPE_LATEST, generate_latest from app.db import db_alive from app.settings import settings +from app.welcome import WELCOME_HTML logging.basicConfig( level=getattr(logging, settings.LOG_LEVEL, logging.INFO), @@ -67,6 +71,15 @@ def create_app() -> FastAPI: response.headers[settings.CORRELATION_ID_HEADER] = cid return response + @app.get("/", response_class=HTMLResponse, include_in_schema=False) + async def welcome() -> HTMLResponse: + """ + Página de bienvenida por defecto del Golden Path. + El tenant la ve en cuanto su plataforma queda lista. En cuanto agrega + su propio handler de `/` (su desarrollo), esta página es reemplazada. + """ + return HTMLResponse(content=WELCOME_HTML) + @app.get("/health", tags=["platform"]) async def health() -> JSONResponse: db_status = "up" if db_alive() else "down"