Internal
Public Access
Add API root endpoint at /api/
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.5
parent
6eb277c701
commit
d1720bebb3
@@ -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)),
|
||||
|
||||
@@ -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'
|
||||
})
|
||||
Reference in New Issue
Block a user