feat: add healtcheck to ok in starlette app
All checks were successful
deploy / deploy (push) Successful in 52s

This commit is contained in:
Stepan Vladovskiy 2024-04-09 15:11:17 -03:00
parent 2b3aa43faf
commit dbf1d8880d

View File

@ -4,6 +4,8 @@ from os.path import exists
from ariadne import load_schema_from_path, make_executable_schema
from starlette.applications import Starlette
from starlette.routing import Route
from starlette.responses import JSONResponse
from services.rediscache import redis
from services.schema import resolvers
@ -22,6 +24,8 @@ async def start():
f.write(str(os.getpid()))
print(f"[main] process started in {MODE} mode")
async def healthcheck(request):
return JSONResponse({"status": "ok"})
# main starlette app object with ariadne mounted in root
app = Starlette(
@ -32,4 +36,7 @@ app = Starlette(
],
on_shutdown=[redis.disconnect],
debug=True,
routes=[
Route('/', healthcheck, methods=['GET']),
],
)