From aaef341586897ad1285874a95aa1ba7c0d3e0ac5 Mon Sep 17 00:00:00 2001 From: Daniel Chalef <131175+danielchalef@users.noreply.github.com> Date: Wed, 24 May 2023 11:17:38 -0700 Subject: [PATCH] add healthz route --- app/api.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/api.py b/app/api.py index 6c81a72..ec106f9 100644 --- a/app/api.py +++ b/app/api.py @@ -4,8 +4,8 @@ import spacy import srsly # type: ignore -from fastapi import Body, FastAPI -from starlette.responses import RedirectResponse +from fastapi import Body, FastAPI, status +from starlette.responses import PlainTextResponse, RedirectResponse from app.entity_models import Request, Response from app.spacy_extractor import SpacyExtractor @@ -22,6 +22,11 @@ extractor = SpacyExtractor(nlp) +@app.get("/healthz", response_model=str, status_code=status.HTTP_200_OK) +def health(): + return PlainTextResponse(".") + + @app.get("/", include_in_schema=False) def docs_redirect(): return RedirectResponse("/docs")