Views in DRF handle HTTP requests and return responses. DRF provides both function-based views (FBVs) and class-based views (CBVs).
Creating an API View
Example: Using APIView
Example: Using GenericAPIView and Mixins
DRF provides mixins for common operations like list, create, retrieve, etc.
Example: Using ViewSets and Routers
ViewSet classes combine logic for multiple actions (e.g., list, retrieve) in a single class, and routers automatically generate URLs.
In urls.py, use a router to handle routing: