Initial MCM project: FastAPI + Textual TUI unified messenger
MultiCustomerMessenger supporting Telegram (python-telegram-bot), WhatsApp (Green API) and SMS (python-gsmmodem-new). REST API with Bearer-token auth, SQLAlchemy models for MariaDB, APScheduler for background polling, and Textual TUI running in same asyncio event-loop.
This commit is contained in:
33
api/app.py
Normal file
33
api/app.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from datetime import datetime
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from api.routes import channels, contacts, conversations, messages
|
||||
|
||||
app = FastAPI(
|
||||
title="MCM – MultiCustomerMessenger API",
|
||||
description="Unified messaging gateway for Telegram, WhatsApp and SMS",
|
||||
version="1.0.0",
|
||||
docs_url="/docs",
|
||||
redoc_url="/redoc",
|
||||
)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# Routen
|
||||
app.include_router(messages.router, prefix="/api/v1")
|
||||
app.include_router(conversations.router, prefix="/api/v1")
|
||||
app.include_router(contacts.router, prefix="/api/v1")
|
||||
app.include_router(channels.router, prefix="/api/v1")
|
||||
|
||||
|
||||
@app.get("/health", tags=["system"])
|
||||
def health():
|
||||
return {"status": "ok", "service": "MCM", "timestamp": datetime.utcnow().isoformat()}
|
||||
Reference in New Issue
Block a user