Skip to content

Commit

Permalink
Move /health endpoint to /api/v1/health (making it public) (#716)
Browse files Browse the repository at this point in the history
This allows us to monitor the API health more easily from a remote
service such as updown.io.
  • Loading branch information
jake-low authored Sep 24, 2024
1 parent 02f435b commit 8f8611e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.views import defaults
from django.views import static as static_views
from django.http import JsonResponse
from django.shortcuts import redirect

from rest_framework import permissions
from drf_yasg.views import get_schema_view
Expand Down Expand Up @@ -59,14 +60,18 @@
permission_classes=(permissions.AllowAny,),
)

def health_redirect(request):
return redirect(API_BASE_URL + 'health')

def health_check(request):
return JsonResponse({'status': 'ok'})

urlpatterns += [
# Django Admin
path('admin/', admin.site.urls),

path('health', health_check),
path('health', health_redirect),
path(API_BASE_URL + 'health', health_check),

# api docs
re_path(
Expand Down

0 comments on commit 8f8611e

Please sign in to comment.