Add API routing for v1 endpoints and health check functionality
This commit is contained in:
11
app/api/__init__.py
Normal file
11
app/api/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""API package."""
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.api import v1
|
||||
|
||||
# Main API router with /api prefix
|
||||
api_router = APIRouter(prefix="/api")
|
||||
|
||||
# Include version routers
|
||||
api_router.include_router(v1.api_router)
|
||||
11
app/api/v1/__init__.py
Normal file
11
app/api/v1/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""API v1 package."""
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.api.v1 import main
|
||||
|
||||
# V1 API router with v1 prefix
|
||||
api_router = APIRouter(prefix="/v1")
|
||||
|
||||
# Include all route modules
|
||||
api_router.include_router(main.router, tags=["main"])
|
||||
16
app/api/v1/main.py
Normal file
16
app/api/v1/main.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""Main router for v1 endpoints."""
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.core.logging import get_logger
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
@router.get("/")
|
||||
def health() -> dict[str, str]:
|
||||
"""Health check endpoint."""
|
||||
logger.info("Health check endpoint accessed")
|
||||
return {"status": "healthy"}
|
||||
Reference in New Issue
Block a user