rest api에 대한 이해
- http method 종류
- get : 조회
- post : 생성
- put : 수정
- delete : 삭제
views.py에서 리퀘스트 처리하기
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import permissions
class UserView(APIView):
permission_classes = [permissions.AllowAny]
def get(self, request):
return Response({'message': 'get method!!'})
def post(self, request):
return Response({'message': 'post method!!'})
def put(self, request):
return Response({'message': 'put method!!'})
def delete(self, request):
return Response({'message': 'delete method!!'})