From d1720bebb3d490519f8510b3ded5dd56e6be1ee8 Mon Sep 17 00:00:00 2001 From: Keith Smith Date: Fri, 26 Dec 2025 17:24:16 -0700 Subject: [PATCH] Add API root endpoint at /api/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created /api/ endpoint that returns JSON with: - API status - Available endpoints - Version information This fixes the "Not Found" error when accessing /api/ and provides a useful API discovery endpoint for clients. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- config/urls.py | 4 ++++ config/views.py | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 config/views.py diff --git a/config/urls.py b/config/urls.py index bb2be53..1090be3 100644 --- a/config/urls.py +++ b/config/urls.py @@ -11,11 +11,15 @@ from users.urls import api_urlpatterns as users_api_urls, web_urlpatterns as use from tasks.urls import api_urlpatterns as tasks_api_urls, web_urlpatterns as tasks_web_urls from sync.urls import api_urlpatterns as sync_api_urls from notifications.urls import api_urlpatterns as notifications_api_urls +from .views import api_root urlpatterns = [ # Admin path('admin/', admin.site.urls), + # API root + path('api/', api_root, name='api-root'), + # API endpoints path('api/users/', include(users_api_urls)), path('api/tasks/', include(tasks_api_urls)), diff --git a/config/views.py b/config/views.py new file mode 100644 index 0000000..47c2a8b --- /dev/null +++ b/config/views.py @@ -0,0 +1,23 @@ +""" +API root views for KeepItGoing. +""" + +from django.http import JsonResponse + + +def api_root(request): + """ + API root endpoint - returns available API endpoints. + """ + return JsonResponse({ + 'message': 'KeepItGoing API', + 'version': '1.0', + 'endpoints': { + 'users': '/api/users/', + 'tasks': '/api/tasks/', + 'sync': '/api/sync/', + 'notifications': '/api/notifications/', + 'admin': '/admin/', + }, + 'status': 'running' + })