Co-authored-by: MENDOZA BALLARDO GAEL RICARDO <gael-meb123@users.noreply.github.com>
Co-authored-by: Azareth-Tr <Azareth-Tr@users.noreply.github.com> Co-authored-by: eddgranados12 <eddgranados12@users.noreply.github.com> configuracion inicial para supoabase y endpoints
This commit is contained in:
36
backend/main.py
Normal file
36
backend/main.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from contextlib import asynccontextmanager
|
||||
from fastapi import FastAPI
|
||||
|
||||
# Aquí se importarán los routers en el futuro
|
||||
# from app.api.routers import auth, addresses, routes, eta
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
"""
|
||||
Maneja el ciclo de vida de la aplicación.
|
||||
Ideal para arrancar el cron job de simulación (APScheduler).
|
||||
"""
|
||||
print("Iniciando aplicación: Backend Sistema de Recolección...")
|
||||
# TODO: Inicializar APScheduler aquí para avanzar current_position_id (1-8)
|
||||
yield
|
||||
print("Apagando aplicación y deteniendo simulador...")
|
||||
# TODO: Apagar APScheduler
|
||||
|
||||
app = FastAPI(
|
||||
title="API - Recolección Inteligente y Privada",
|
||||
description="Backend para el sistema de recolección de residuos con privacidad por diseño.",
|
||||
version="1.0.0",
|
||||
lifespan=lifespan
|
||||
)
|
||||
|
||||
# Endpoints de prueba base
|
||||
@app.get("/")
|
||||
def read_root():
|
||||
return {
|
||||
"status": "ok",
|
||||
"message": "Backend operativo. Regla Innegociable 1: NUNCA se devuelven coordenadas del camión al ciudadano."
|
||||
}
|
||||
|
||||
@app.get("/health")
|
||||
def health_check():
|
||||
return {"status": "healthy"}
|
||||
Reference in New Issue
Block a user