Добавление жанров, дополнение описания

This commit is contained in:
2025-10-20 22:24:00 +03:00
parent 9604771439
commit ddcae6cdf6
13 changed files with 147 additions and 136 deletions

View File

@@ -10,29 +10,32 @@ from httpx import get
from library_service.settings import get_app
# Templates initialization
# Загрузка шаблонов
templates = Jinja2Templates(directory=Path(__file__).parent.parent / "templates")
router = APIRouter(tags=["misc"])
# Formatted information about the application
# Форматированная информация о приложении
def get_info(app) -> Dict:
return {
"status": "ok",
"app_info": {
"title": app.title,
"version": app.version,
"description": app.description,
},
"server_time": datetime.now().isoformat(),
}
"status": "ok",
"app_info": {
"title": app.title,
"version": app.version,
"description": app.description,
},
"server_time": datetime.now().isoformat(),
}
# Root endpoint
# Эндпоинт главной страницы
@router.get("/", response_class=HTMLResponse)
async def root(request: Request, app=Depends(get_app)):
return templates.TemplateResponse(request, "index.html", get_info(app))
# API Information endpoint
# Эндпоинт информации об API
@router.get("/api/info")
async def api_info(app=Depends(get_app)):
return JSONResponse(content=get_info(app))