Skip to content

Commit acbebb3

Browse files
committed
document update
1 parent e4a6e85 commit acbebb3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/api_controller/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# **Controller**
2-
The term 'APIController' is borrowed from the C# ASP.NET environment, which uses the MVC framework. Although Django is not an MVC framework, it is still possible to mimic the concept by using similar patterns and principles.
3-
Django-Ninja-Extra's APIController is modeled after the C# ASP.NET ApiController, providing an object-oriented approach to creating controller models and implementing modern software design patterns in your Django project. This allows you to use similar concepts and design patterns as in C# ASP.NET environment in your Django project.
2+
The term 'APIController' is borrowed from the C# ASP.NET environment, which uses the MVC framework.
3+
Although Django is not an MVC framework, it is still possible to mimic the concept by using similar patterns and principles.
44

5-
### Why APIController in Django.
5+
Django-Ninja-Extra's APIController is modeled after the C# ASP.NET ApiController, providing an object-oriented approach to creating controller models and implementing modern software design patterns in your Django project.
6+
This allows you to use similar concepts and design patterns as in C# ASP.NET environment in your Django project.
67

7-
Coming from a background of modeling objects using class-based approaches, and having experience working with various API tools such as DRF, FastAPI, and Flask-Restful, you have likely noticed that these libraries primarily use function-based or class-tailored function-based approaches in writing route functions. This approach may not fully utilize the concepts of object-oriented programming when designing RESTful APIs. But despite this, these libraries are still great.
8+
In Ninja-Extra, there are major components to creating a controller
89

9-
I have designed the APIController in Django Ninja Extra to bring a more traditional controller-based approach to Django Ninja, providing more flexibility and adaptability to recent software design patterns.
10-
If you prefer using class-based controls for building APIs, Django Ninja Extra's APIController is a great option for you.
10+
- ControllerBase
11+
- APIController Decorator
1112

1213
## ControllerBase
1314

@@ -32,7 +33,6 @@ class UserControllerBase(ControllerBase):
3233
...
3334
```
3435

35-
3636
## APIController Decorator
3737
The `api_controller` decorator is used to define a class-based controller in Django Ninja Extra.
3838
It is applied to a ControllerBase class and takes several arguments to configure the routes and functionality of the controller.

0 commit comments

Comments
 (0)