Two Scoops Study Session 11
Key point
We reviewed Chapter 16 of Two Scoops of Django to organize the principles of REST API implementation and how to use DRF.
Details
We went through Chapter 16 of Two Scoops of Django, Implementing REST APIs, together. Moonsoo, who has taken on API development for a new project just starting, organized the book's content and presented it, and we revisited the point that REST API is a design approach for providing data suited to various environments and use cases.
To build a good REST API architecture, simply implementing things quickly with django-rest-framework (DRF) isn't enough. The key advice was that you should keep the project code concise, keep app code inside the app, separate business logic from API views, consolidate API URLs, and also consider versioning.
We also covered the service-oriented architecture perspective of breaking a web application into independent components. When different servers communicate via REST API, multiple engineers can develop separated components in parallel without conflicts, and the benefits of this kind of structure grow as scale increases.
From a framework standpoint, the assessment was that django-rest-framework has already established itself as the de facto standard. It's widely used in Django projects, and it was also mentioned that its support for both class-based views and function-based views makes it highly practical to apply in real-world work.
During the deep-dive session, someone shared an experience from a previous company where servers were split by role and connected via REST API. At the time, frameworks weren't as stable as they are now, which made things more inconvenient, but it also made clear just how convenient today's tools have become.
Finally, we looked at designing interactions using collection, document, and controller resources and URIs, and HTTP, from the Resource perspective. Using the GitHub Pull Requests API as an example, we concretized the concept of using an API, and the presenter summed up that this process made the necessity of REST APIs and the motivation to learn them even clearer.