urls.py 739 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
17
for v in ALL_API_VIEWSETS:
    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
21
urlpatterns.append(url(r"^api/", include(router.urls)))

22
23
24
25
# We need to register some extra viewset

for v in ALL_API_VIEW_VIEWSETS:
    urlpatterns.append(url(r"^api/{}/".format(v.end_point_route), v.as_view()))