Files
WhatsAppCentralizado/services/api-gateway/app/main.py
Claude AI 14a579d5ca feat(fase2): add Flow API routes and Flow Engine main app
API Gateway:
- Add flows router with CRUD endpoints
- Add activate/deactivate endpoints
- Auto-deactivate other flows for welcome/fallback triggers

Flow Engine:
- Add main.py with FastAPI app
- Add /process endpoint for message handling
- Add SQLAlchemy models (mirrors api-gateway)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:20:35 +00:00

42 lines
919 B
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.core.config import get_settings
from app.core.database import engine, Base
from app.routers import auth, whatsapp, flows
settings = get_settings()
# Create tables
Base.metadata.create_all(bind=engine)
app = FastAPI(
title="WhatsApp Centralizado API",
description="API Gateway for WhatsApp Centralizado platform",
version="1.0.0",
)
# CORS
origins = settings.CORS_ORIGINS.split(",")
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Routers
app.include_router(auth.router)
app.include_router(whatsapp.router)
app.include_router(flows.router)
@app.get("/health")
def health_check():
return {"status": "ok"}
@app.get("/api/health")
def api_health_check():
return {"status": "ok", "service": "api-gateway"}