diff options
| author | Tom Christie | 2013-04-09 11:54:51 +0100 | 
|---|---|---|
| committer | Tom Christie | 2013-04-09 11:54:51 +0100 | 
| commit | 027792c981b1442a018e382a6fa2e58496b0b750 (patch) | |
| tree | c53fd735ae3dd7a5d941be63a71432c072940d76 /docs/api-guide/routers.md | |
| parent | 371698331c979305b5684f864ee6bf5b6d11a44e (diff) | |
| download | django-rest-framework-027792c981b1442a018e382a6fa2e58496b0b750.tar.bz2 | |
Viewsets and routers in seperate docs
Diffstat (limited to 'docs/api-guide/routers.md')
| -rw-r--r-- | docs/api-guide/routers.md | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md new file mode 100644 index 00000000..dbb352fe --- /dev/null +++ b/docs/api-guide/routers.md @@ -0,0 +1,27 @@ +<a class="github" href="routers.py"></a> + +# Routers + +> Resource routing allows you to quickly declare all of the common routes for a given resourceful controller. Instead of declaring separate routes for your index... a resourceful route declares them in a single line of code. +> +> — [Ruby on Rails Documentation][cite] + +Some Web frameworks such as Rails provide functionality for automatically determining how the URLs for an application should be mapped to the logic that deals with handling incoming requests. + +Conversely, Django stops short of automatically generating URLs, and requires you to explicitly manage your URL configuration. + +REST framework adds support for automatic URL routing, which provides you with a simple, quick and consistent way of wiring your view logic to a set of URLs. + +# API Guide + +Routers provide a convenient and simple shortcut for wiring up your application's URLs. + +    router = routers.DefaultRouter() +    router.register('^/', APIRoot, 'api-root') +    router.register('^users/', UserViewSet, 'user') +    router.register('^groups/', GroupViewSet, 'group') +    router.register('^accounts/', AccountViewSet, 'account') + +    urlpatterns = router.urlpatterns + +[cite]: http://guides.rubyonrails.org/routing.html
\ No newline at end of file | 
