Spaces:
Sleeping
Sleeping
Update api/__init__.py
Browse files- api/__init__.py +3 -11
api/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from fastapi import APIRouter
|
| 2 |
import logging
|
| 3 |
|
| 4 |
# Configure logging
|
|
@@ -10,14 +10,6 @@ logger = logging.getLogger(__name__)
|
|
| 10 |
|
| 11 |
def get_router():
|
| 12 |
router = APIRouter()
|
| 13 |
-
|
| 14 |
-
# Middleware to log incoming requests
|
| 15 |
-
@router.middleware("http")
|
| 16 |
-
async def log_requests(request: Request, call_next):
|
| 17 |
-
logger.info(f"Incoming request: {request.method} {request.url.path} from {request.client.host}")
|
| 18 |
-
response = await call_next(request)
|
| 19 |
-
logger.info(f"Response status: {response.status_code} for {request.method} {request.url.path}")
|
| 20 |
-
return response
|
| 21 |
|
| 22 |
# Import sub-modules from the routes directory
|
| 23 |
from .routes.auth import auth
|
|
@@ -25,9 +17,9 @@ def get_router():
|
|
| 25 |
from .routes.pdf import pdf
|
| 26 |
|
| 27 |
# Include sub-routers, prioritizing patients to avoid conflicts
|
| 28 |
-
router.include_router(patients, prefix="/ehr", tags=["patients"])
|
| 29 |
router.include_router(auth, prefix="/auth", tags=["auth"])
|
| 30 |
-
router.include_router(pdf, prefix="/ehr/patients", tags=["pdf"])
|
| 31 |
|
| 32 |
return router
|
| 33 |
|
|
|
|
| 1 |
+
from fastapi import APIRouter
|
| 2 |
import logging
|
| 3 |
|
| 4 |
# Configure logging
|
|
|
|
| 10 |
|
| 11 |
def get_router():
|
| 12 |
router = APIRouter()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Import sub-modules from the routes directory
|
| 15 |
from .routes.auth import auth
|
|
|
|
| 17 |
from .routes.pdf import pdf
|
| 18 |
|
| 19 |
# Include sub-routers, prioritizing patients to avoid conflicts
|
| 20 |
+
router.include_router(patients, prefix="/ehr", tags=["patients"])
|
| 21 |
router.include_router(auth, prefix="/auth", tags=["auth"])
|
| 22 |
+
router.include_router(pdf, prefix="/ehr/patients", tags=["pdf"])
|
| 23 |
|
| 24 |
return router
|
| 25 |
|