Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DRF Nested Routers in order to automatically generate API Endpoints for all of the attributes for a given Model #424

Open
abrahmasandra opened this issue Dec 7, 2023 · 0 comments
Labels
enhancement New feature or request x/api
Milestone

Comments

@abrahmasandra
Copy link
Contributor

abrahmasandra commented Dec 7, 2023

  • 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 the friends of a given User, 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 your API, 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 the API

@abrahmasandra abrahmasandra added the enhancement New feature or request label Dec 7, 2023
@abrahmasandra abrahmasandra added this to the Backlog milestone Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request x/api
Projects
Status: Backlog
Development

No branches or pull requests

2 participants