from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

# Django Imports
from django.conf.urls import include, url

# App Imports
from .views import CategoryViewSet, FacilityViewSet, ScheduleViewSet

# Other Imports
from rest_framework.routers import DefaultRouter

# Instiantiate our DefaultRouter
ROUTER = DefaultRouter()

# Register views to the API router
ROUTER.register(r'categories', CategoryViewSet)
ROUTER.register(r'facilities', FacilityViewSet)
ROUTER.register(r'schedules', ScheduleViewSet)

urlpatterns = [
    # /api - Root API URL
    url(r'^api/', include(ROUTER.urls)),
]

from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

# Django Imports
from django.conf.urls import include, url
from django.views.generic.base import RedirectView

# App Imports
from .views import CategoryViewSet, FacilityViewSet, ScheduleViewSet

# Other Imports
from rest_framework.routers import DefaultRouter

# Instiantiate our DefaultRouter
ROUTER = DefaultRouter()

# Register views to the API router
ROUTER.register(r'categories', CategoryViewSet)
ROUTER.register(r'facilities', FacilityViewSet)
ROUTER.register(r'schedules', ScheduleViewSet)

urlpatterns = [
    # / - Default route
    # We redirect to /api since this is in reality the default page for the API
    url(r'^$', RedirectView.as_view(url='/api')),
    # /api - Root API URL
    url(r'^api/', include(ROUTER.urls)),
]

Add a redirect for / -> /api
refactor: Add a redirect for / -> /api

- This got really annoying in development to remember to go to /api all the time
- Potentially in the future we will build a test landing page on / to test that
the API works instead of having to rely on third party tools or just manual clicks
	- Until then, this will make life easier (imo)

  from __future__ import (absolute_import, division, print_function,
                          unicode_literals)
  
  # Django Imports
  from django.conf.urls import include, url
+ from django.views.generic.base import RedirectView
  
  # App Imports
  from .views import CategoryViewSet, FacilityViewSet, ScheduleViewSet
  
  # Other Imports
  from rest_framework.routers import DefaultRouter
  
  # Instiantiate our DefaultRouter
  ROUTER = DefaultRouter()
  
  # Register views to the API router
  ROUTER.register(r'categories', CategoryViewSet)
  ROUTER.register(r'facilities', FacilityViewSet)
  ROUTER.register(r'schedules', ScheduleViewSet)
  
  urlpatterns = [
+     # / - Default route
+     # We redirect to /api since this is in reality the default page for the API
+     url(r'^$', RedirectView.as_view(url='/api')),
      # /api - Root API URL
      url(r'^api/', include(ROUTER.urls)),
  ]
  
Add a redirect for / -> /api
## Code Before:
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

# Django Imports
from django.conf.urls import include, url

# App Imports
from .views import CategoryViewSet, FacilityViewSet, ScheduleViewSet

# Other Imports
from rest_framework.routers import DefaultRouter

# Instiantiate our DefaultRouter
ROUTER = DefaultRouter()

# Register views to the API router
ROUTER.register(r'categories', CategoryViewSet)
ROUTER.register(r'facilities', FacilityViewSet)
ROUTER.register(r'schedules', ScheduleViewSet)

urlpatterns = [
    # /api - Root API URL
    url(r'^api/', include(ROUTER.urls)),
]

## Instruction:
Add a redirect for / -> /api
## Code After:
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

# Django Imports
from django.conf.urls import include, url
from django.views.generic.base import RedirectView

# App Imports
from .views import CategoryViewSet, FacilityViewSet, ScheduleViewSet

# Other Imports
from rest_framework.routers import DefaultRouter

# Instiantiate our DefaultRouter
ROUTER = DefaultRouter()

# Register views to the API router
ROUTER.register(r'categories', CategoryViewSet)
ROUTER.register(r'facilities', FacilityViewSet)
ROUTER.register(r'schedules', ScheduleViewSet)

urlpatterns = [
    # / - Default route
    # We redirect to /api since this is in reality the default page for the API
    url(r'^$', RedirectView.as_view(url='/api')),
    # /api - Root API URL
    url(r'^api/', include(ROUTER.urls)),
]
