This commit is contained in:
2026-02-03 17:15:58 +05:00
commit 335db59c9c
11 changed files with 738 additions and 0 deletions

28
route/base.py Normal file
View File

@@ -0,0 +1,28 @@
import tomllib
from pathlib import Path
from fastapi import APIRouter
# Создаем базовый router для FastAPI
router = APIRouter(tags=["base"])
def get_version():
"""Получить версию из pyproject.toml"""
try:
pyproject_path = Path(__file__).parent.parent / "pyproject.toml"
with open(pyproject_path, "rb") as f:
pyproject = tomllib.load(f)
return pyproject["project"]["version"]
except:
return "0.1.0"
@router.get("/")
async def root():
return {"message": "API is running"}
@router.get("/health")
async def health():
return {"status": "ok"}
@router.get("/version")
async def version():
return {"version": get_version()}