MERN #3

jaeha_lee·2023년 4월 23일
0
Method설명
GET서버에서 리소스 받음
POST서버에 리소스를 보냄 (create or append 리소스)
PUT서버에 리소스를 PUT (create or overwrite 리소스)
PATCH서버에 있는 존재하는 리소스의 값을 변경함
DELETE-

GraphQL

  • GraphQL은 단 하나의 EndPoint만 존재하고
  • 선택한 경로에 대한 POST 요청이 존재하고, 경로는 대개 /graphql 이다
// A GraphQL Query
{
	query{ // Operation type : mutation, subscription ...
    	user{ // Operation EndPoitn
        	name // Request Field
            age
        }
    }
}

RestAPI

  • 데이터는 JSON 포맷으로 Ajax 백그라운드 요청을 통해 교환된다.

보통 Node Express 앱과 데이터 베이스 서버를 따로 나둔다. (API + SPA)
이 경우 Node API가 들어오는 requests를 처리하고
React SPA가 분리된 static host로 부터 처리됨

0개의 댓글