(과제) 아래의 조건을 만족하는 API를 구축하고, 이를 현재 레포의 브랜치에 업로드해 주세요.
- 브랜치는 https://github.com/IDU-IFP/ifp-flask-study/tree/<본인 깃허브 닉네임> 에 업로드해 주시면 됩니다!
- "animal" 은 "이름", "나이" 의 정보를 가집니다. 아래는 예시입니다.
- { "name" : "톱가오리", "age" : " 3" }
- GET /animals
- 모든 동물에 대한 목록 조회
- GET /animal/<name>
- 이름으로 고유하게 식별되는 특정 동물 "한 마리"의 상세정보를 반환, 동물들은 같은 이름을 가질 수 없음
- POST /animal/<name>
- <name> 이라는 이름을 가지는 동물 한 마리를 생성, 같은 이름을 가지고 있는 동물이 있다면 생성은 실패해야 함
- PUT /animal/<name>
- <name> 이라는 이름을 가지고 있는 동물 한 마리를 생성하거나, 이미 그 이름을 가지고 있는 동물이 존재한다면 정보를 수정
- DELETE /animal/<name>
- <name> 이라는 이름을 가지고 있는 동물 한 마리를 죽임
Ep08부터는 flask-restful 라이브러리를 활용하여 HTTP API 를 구축하는 방법에 대해 다룹니다.
이번 에피소드를 마치고 나면, cars/ 와 car/ 두 개의 엔드포인트로 자동차에 대한 목록 조회, 상세 조회, 생성, 수정, 삭제를 할 수 있는 API 서버를 구축할 수 있을 것입니다.
(과제) Flask 의 pluggable view 에 대한 설명을 블로그에 간략하게 정리해 주세요.
(과제) 아래의 조건을 만족하는 API를 구축하고, 이를 현재 레포의 브랜치에 업로드해 주세요.
참고 자료
https://gdsanadev.com/14924 - 생성 / 조회 API 구현 https://gdsanadev.com/15064 - 수정 / 삭제 API 구현 https://flask-docs-kr.readthedocs.io/ko/latest/views.html - pluggable view 공식 문서 https://flask-restful.readthedocs.io/en/latest/ - flask-restful 공식 문서