urls.py 608 Bytes
Newer Older
1 2 3 4
from django.conf.urls import include, url
from rest_framework import routers
from rest_framework.documentation import include_docs_urls

5
from backend_app.viewsets import ALL_API_VIEWSETS, ALL_API_VIEW_VIEWSETS
6

7 8 9
#######
# Building the API routing
#######
10

11
urlpatterns = [url(r"^api-doc/", include_docs_urls(title="REX-DRI API"))]
12

13 14
# router will hold all api related endpoints
router = routers.DefaultRouter()
Florent Chehab's avatar
Florent Chehab committed
15

16
for v in ALL_API_VIEWSETS + ALL_API_VIEW_VIEWSETS:
17
    router.register(v.end_point_route, v, str(v))
18

Florent Chehab's avatar
Florent Chehab committed
19
# Add all the endpoints for the base api
20
urlpatterns.append(url(r"^api/", include(router.urls)))