Add healthcheck

This commit is contained in:
2022-02-05 11:50:24 +03:00
parent c80054cf55
commit baae2c850b
6 changed files with 133 additions and 16 deletions

View File

@@ -122,3 +122,13 @@ async def get_language(code: str):
@languages_router.post("/", response_model=LanguageDetail)
async def create_language(data: CreateLanguage):
return await Language.objects.create(**data.dict())
healthcheck_router = APIRouter(
tags=["healthcheck"], dependencies=[Depends(check_token)]
)
@healthcheck_router.get("/healthcheck")
async def healthcheck():
return "Ok!"

View File

@@ -2,7 +2,7 @@ from fastapi import FastAPI
from fastapi_pagination import add_pagination
from app.views import users_router, languages_router
from app.views import users_router, languages_router, healthcheck_router
from core.db import database
@@ -11,6 +11,7 @@ def start_app() -> FastAPI:
app.include_router(users_router)
app.include_router(languages_router)
app.include_router(healthcheck_router)
app.state.database = database