feat: add healtcheck to ok in starlette app
All checks were successful
deploy / deploy (push) Successful in 52s
All checks were successful
deploy / deploy (push) Successful in 52s
This commit is contained in:
parent
2b3aa43faf
commit
dbf1d8880d
7
main.py
7
main.py
|
@ -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']),
|
||||
],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user