from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from .routers import translate app = FastAPI( title="Google Translate API", description="API для перевода текста через Google Translate", version="1.0.0" ) app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) app.include_router(translate.router) @app.get("/") async def root(): return { "message": "Google Translate API", "docs": "/docs", "endpoints": [ "GET /api/v1/translate/?text=hello&target=ru", "POST /api/v1/translate/", "GET /api/v1/translate/languages" ] } @app.get("/health") async def health(): return {"status": "healthy"}