Spaces:
Runtime error
Runtime error
File size: 731 Bytes
3ec4ff0 bc0521a 3ec4ff0 bc0521a 3ec4ff0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
"""API v1 route handlers."""
from fastapi import APIRouter
from typing import Dict, List
from src.modules.transporter import publish_message
# Create v1 router
router = APIRouter(prefix='/v1', tags=['v1'])
@router.get("/hello")
async def hello_world() -> Dict[str, str]:
"""Hello world endpoint."""
publish_message("hello-python", "Hello from FastAPI!")
return {"message": "Hello, World!"}
@router.get("/health")
async def health_check() -> Dict[str, str]:
"""Health check endpoint."""
return {"status": "healthy"}
@router.get("/metrics")
async def metrics() -> Dict[str, int]:
"""Application metrics endpoint."""
return {
"total_routes": len(router.routes),
"api_version": 1
}
|