Use DRF Nested Routers
in order to automatically generate API
Endpoints for all of the attributes for a given Model
#424
Labels
Milestone
Currently, we are manually creating each and every endpoint for each model. Then, if there is a
ManyToMany
relationship within a model, and we manually create a nested endpoint. For example, to get thefriends
of a givenUser
, we manually created the endpoint/api/users/<user_id>/friends
.The
DRF Nested Routers
package provides routers that allow you to easily create nested routes for yourAPI
, without manually creating every endpoint. You can use it to create nested routes for all the attributes in a model. This would not only shorten the code, but also create a more exhaustive list of endpoints for theAPI
The text was updated successfully, but these errors were encountered: