Luv33preet
Luv33preet

Reputation: 1867

DRF: Disable GET request on the base url route path

This is my urlpatterns in base urls.py,

urlpatterns = [
    path('api/', include((router.urls, 'api'), namespace='api')),
]

when I browse to localhost:8000/api/, it exposes all my routes,

{
    "accounts": "http://localhost:8000/api/accounts/",
    "cases":"http://localhost:8000/api/cases/",
    "issues": "http://localhost:8000/api/issues/"
}

Is there any way I can disable this exposing on django application level?

Upvotes: 0

Views: 377

Answers (1)

Linovia
Linovia

Reputation: 20976

You should use SimpleRouter instead of DefaultRouter. The latter adds the view to the routing provided by the former.

Upvotes: 2

Related Questions