<reponame>anonshubh/blog_api<filename>posts/urls.py
from django.urls import path
from .views import PostList,PostDetail,UserDetail,UserList,UserViewSet,PostViewSet
from rest_framework import routers
'''
urlpatterns=[
    path('',PostList.as_view()),
    path('<int:pk>',PostDetail.as_view()),
    path('users/',UserList.as_view()),
    path('users/<int:pk>',UserDetail.as_view()),
]
'''
# Routers
router = routers.SimpleRouter()
router.register('users',UserViewSet,basename='users')
router.register('',PostViewSet,basename='posts')

urlpatterns = router.urls
from django.urls import path
from .views import PostList,PostDetail,UserDetail,UserList,UserViewSet,PostViewSet
from rest_framework import routers
'''
urlpatterns=[
    path('',PostList.as_view()),
    path('<int:pk>',PostDetail.as_view()),
    path('users/',UserList.as_view()),
    path('users/<int:pk>',UserDetail.as_view()),
]
'''
# Routers
router = routers.SimpleRouter()
router.register('users',UserViewSet,basename='users')
router.register('',PostViewSet,basename='posts')

urlpatterns = router.urls
urlpatterns=[     path('',PostList.as_view()),     path('<int:pk>',PostDetail.as_view()),     path('users/',UserList.as_view()),     path('users/<int:pk>',UserDetail.as_view()), ] # Routers