feat: Add environment configuration files and update settings for production and development
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Main router for v1 endpoints."""
|
||||
|
||||
from fastapi import APIRouter
|
||||
from fastapi.responses import HTMLResponse
|
||||
|
||||
from app.core.logging import get_logger
|
||||
from app.schemas.common import HealthResponse
|
||||
@@ -15,3 +16,69 @@ def health() -> HealthResponse:
|
||||
"""Health check endpoint."""
|
||||
logger.info("Health check endpoint accessed")
|
||||
return HealthResponse(status="healthy")
|
||||
|
||||
|
||||
@router.get("/scalar-docs", response_class=HTMLResponse)
|
||||
def scalar_docs() -> HTMLResponse:
|
||||
"""Serve the API documentation using Scalar."""
|
||||
return """
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>API Documentation - Scalar</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
</head>
|
||||
<body>
|
||||
<script
|
||||
id="api-reference"
|
||||
data-url="http://localhost:8000/api/openapi.json"
|
||||
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
|
||||
@router.get("/rapidoc-docs", response_class=HTMLResponse)
|
||||
async def rapidoc() -> HTMLResponse:
|
||||
"""Serve the API documentation using Rapidoc."""
|
||||
return """
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>API Documentation - Rapidoc</title>
|
||||
<meta charset="utf-8">
|
||||
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<rapi-doc
|
||||
spec-url="http://localhost:8000/api/openapi.json"
|
||||
theme="dark"
|
||||
render-style="read">
|
||||
</rapi-doc>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
|
||||
@router.get("/elements-docs", response_class=HTMLResponse)
|
||||
async def elements_docs() -> HTMLResponse:
|
||||
"""Serve the API documentation using Stoplight Elements."""
|
||||
return """
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>API Documentation - elements</title>
|
||||
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<elements-api
|
||||
apiDescriptionUrl="http://localhost:8000/api/openapi.json"
|
||||
router="hash"
|
||||
/>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user