설치 명령어(+ setting.py의 INSTALLED_APPS에 rest_framework 추가 필요)
pipenv install djangorestframework
HyperlinkedModelSerializer: PK를 리턴하는 게 아니라, 실제 리소스에 접근할 URI를 만들어 리턴함
참고: https://stackoverflow.com/questions/33421147/what-is-the-benefit-of-using-a-hyperlinkedmodelserializer-in-drf
참고: https://stackoverflow.com/questions/33421147/what-is-the-benefit-of-using-a-hyperlinkedmodelserializer-in-drf
httpie: brew보다는 pip으로 설치하자...
pip3 install httpie
pip3 install httpie
ViewSet: 설정을 통한 라우팅 자동 할당, 보통 한 개의 모델에 대한 API 집합체를 적은 코드로 구현할 수 있음
https://www.django-rest-framework.org/api-guide/viewsets
https://www.django-rest-framework.org/api-guide/viewsets
Adding Optional Format Suffixes
https://www.django-rest-framework.org/tutorial/2-requests-and-responses/#adding-optional-format-suffixes-to-our-urls
=> DRF를 사용하면 Response의 Content-Type을 쉽게 변경할 수 있기에,
http://example.com/api/items/4.json 처럼 URL의 접미사를 써서 response의 형식을 정해줄 수도 있음!
https://www.django-rest-framework.org/tutorial/2-requests-and-responses/#adding-optional-format-suffixes-to-our-urls
=> DRF를 사용하면 Response의 Content-Type을 쉽게 변경할 수 있기에,
http://example.com/api/items/4.json 처럼 URL의 접미사를 써서 response의 형식을 정해줄 수도 있음!
Browsable API - 웹 브라우저로 APIView에 접근하면 기본 설정에서는 HTML 타입 리턴, 즉 브라우저에서 API를 확인할 수 있음!
Because the API chooses the content type of the response based on the client request, it will, by default, return an HTML-formatted representation of the resource when that resource is requested by a web browser. This allows for the API to return a fully web-browsable HTML representation.
Because the API chooses the content type of the response based on the client request, it will, by default, return an HTML-formatted representation of the resource when that resource is requested by a web browser. This allows for the API to return a fully web-browsable HTML representation.
배포 모드에서는 Browsable API 기능을 끄고, 개발 모드에서만 활성화하는 방법 등
https://stackoverflow.com/a/49395080/6198924
https://stackoverflow.com/a/49395080/6198924