필요한 패키지를 설치해줍니다.
(optional) pip install django
pip install djangorestframework
pip install django-cors-headers
DB 마이그레이션을 한 후 서버를 켭니다.
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
URL | METHOD | Description | Params | Return |
---|---|---|---|---|
/api/posts | GET |
전체 글을 조회합니다. | [...{Post}] | |
/api/posts | POST |
새로운 글을 작성합니다. | {title:'',content:''} | {Post} |
/api/posts/[id] | GET |
특정 id의 글을 조회합니다. | {Post} | |
/api/posts/[id] | DELETE |
특정 id의 글을 삭제합니다. |