"페이크 REST API 서버 JSONPlaceholder"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-==참고 자료== +==참고==))
3번째 줄: 3번째 줄:
* 페이크 REST API 서버
* 페이크 REST API 서버


<source lang='html'>
<source lang='javascript'>
<script src="//code.jquery.com/jquery.min.js"></script>
fetch('https://jsonplaceholder.typicode.com/posts/1')
<script>
   .then((response) => response.json())
var root = 'https://jsonplaceholder.typicode.com';
   .then((json) => console.log(json));
$.ajax({
  url: root + '/posts/1',
   method: 'GET'
}).then(function(data) {
   console.log(data);
});
// Object {userId: 1, id: 1, title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", body: "quia et suscipit↵suscipit recusandae consequuntur …strum rerum est autem sunt rem eveniet architecto"}
</script>
</source>
</source>



2021년 12월 27일 (월) 23:16 판

1 개요

JSONPlaceholder
  • 페이크 REST API 서버
fetch('https://jsonplaceholder.typicode.com/posts/1')
  .then((response) => response.json())
  .then((json) => console.log(json));

2 예시

동작 메소드 경로 예시URL
글목록 조회 GET /posts http://jsonplaceholder.typicode.com/posts
1번 글 조회 GET /posts/1 http://jsonplaceholder.typicode.com/posts/1
1번 글의 댓글목록 조회 GET /posts/1/comments http://jsonplaceholder.typicode.com/posts/1/comments
새글 입력 POST /posts http://jsonplaceholder.typicode.com/posts
1번 글 수정 PUT /posts/1 http://jsonplaceholder.typicode.com/posts/1
1번 글 수정 PATCH /posts/1 http://jsonplaceholder.typicode.com/posts/1
1번 글 삭제 DELETE /posts/1 http://jsonplaceholder.typicode.com/posts/1

3 같이 보기

4 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}