Adding a Router

Learn how to create routes in Django and how to send http requests to RESTful API using Insomnia.

Routers allow us to quickly declare all of the common routes for a given controller. The next code snippet shows a viewset to which we will be adding a router.

At the root of the apps project (core), create a file named routers.py.

And let’s add the code:

Get hands-on with 1200+ tech skills courses.