Files
suivi_produit/backend/app/main.py
gilles a49b0e3bad feat: add debug page with tables and logs viewer (Step 1)
Backend:
- Add /debug/tables endpoint to dump SQLite tables
- Add /debug/logs endpoint to read scrap.log

Frontend:
- Add react-router-dom for navigation
- Create HomePage and DebugPage components
- Add navigation bar with Debug link
- Style debug page with Gruvbox theme
- Fix package.json dependencies versions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 19:27:23 +01:00

39 lines
991 B
Python

from __future__ import annotations
from os import getenv
from fastapi import FastAPI
from dotenv import load_dotenv
from backend.app.api import routes_config, routes_debug, routes_products, routes_scrape
from backend.app.core.logging import logger
from backend.app.core.scheduler import start_scheduler
from backend.app.db.database import Base, engine
load_dotenv()
app = FastAPI(title="suivi_produit")
app.include_router(routes_products.router)
app.include_router(routes_scrape.router)
app.include_router(routes_config.router)
app.include_router(routes_debug.router)
@app.on_event("startup")
def on_startup() -> None:
Base.metadata.create_all(bind=engine)
# démarrer le scheduler APScheduler en chargeant la config
start_scheduler()
logger.info("Application démarrée (%s)", getenv("APP_ENV", "development"))
@app.get("/health")
def health() -> dict[str, str]:
# endpoint de santé minimal
return {"statut": "ok"}
def main() -> FastAPI:
return app