mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-01-17 11:40:39 +03:00
add auth and redis endpoints
This commit is contained in:
16
app/api/health.py
Normal file
16
app/api/health.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import logging
|
||||
|
||||
from fastapi import APIRouter, status, Request
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/redis", status_code=status.HTTP_200_OK)
|
||||
async def redis_check(request: Request):
|
||||
_redis = await request.app.state.redis
|
||||
_info = None
|
||||
try:
|
||||
_info = await _redis.info()
|
||||
except Exception as e:
|
||||
logging.error(f"Redis error: {e}")
|
||||
return _info
|
||||
Reference in New Issue
Block a user