Skip to content

Commit

Permalink
feat: Add health check endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro-Meireles committed Feb 26, 2024
1 parent a917853 commit a944a26
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apip/health_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from typing import TYPE_CHECKING

from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status

if TYPE_CHECKING:
from rest_framework.request import Request


class HealthCheckView(APIView):

authentication_classes = []

def get(self, request: "Request") -> "Response":
return Response({"up": True}, status=status.HTTP_200_OK)
2 changes: 2 additions & 0 deletions apip/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
from django.conf.urls.static import static
from django.conf import settings

from .health_check import HealthCheckView
from apip.testplans import urls as testplans_urls


urlpatterns = [
path("", lambda service: redirect("adminservices/service/", permanent=True)),
path("health-check", HealthCheckView.as_view()),
path("admin", admin.site.urls),
path("api/", include(testplans_urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

0 comments on commit a944a26

Please sign in to comment.