From e16ed2dd14080ed7e941921e1d1100d04185f156 Mon Sep 17 00:00:00 2001 From: Leandro Lima Date: Tue, 30 Apr 2024 14:52:55 -0700 Subject: [PATCH] feat: adding health check --- hello/echo/api.py | 4 ++++ hello/echo/urls.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hello/echo/api.py b/hello/echo/api.py index cb428d7..1f70490 100644 --- a/hello/echo/api.py +++ b/hello/echo/api.py @@ -28,3 +28,7 @@ def get_message(request, id): def get_all_messages(request): all_messages = list(Message.objects.all().values('id', 'message')) return JsonResponse(all_messages, safe=False) + + +def health(request): + return HttpResponse() diff --git a/hello/echo/urls.py b/hello/echo/urls.py index 48ef555..67c86e3 100644 --- a/hello/echo/urls.py +++ b/hello/echo/urls.py @@ -8,5 +8,6 @@ path('api/get_message//', api.get_message, name="get_message"), path('api/get_all_messages/', api.get_all_messages, name="get_all_messages"), path('api/add_message/', api.AddMessage.as_view(), name="add_message"), - path('api/edit_message/', api.EditMessage.as_view(), name="edit_message") + path('api/edit_message/', api.EditMessage.as_view(), name="edit_message"), + path('api/health', api.health, name="health") ]