"Axios"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
4번째 줄: 4번째 줄:


==예시: GET 요청==
==예시: GET 요청==
<source lang='javascript'>
<syntaxhighlight lang='javascript'>
axios.get('/user?ID=12345')
axios.get('/user?ID=12345')
   .then(function (response) {
   .then(function (response) {
12번째 줄: 12번째 줄:
     console.log(error);
     console.log(error);
   });
   });
</source>
</syntaxhighlight>
<source lang='javascript'>
<syntaxhighlight lang='javascript'>
axios.get('/user', {
axios.get('/user', {
     params: {
     params: {
25번째 줄: 25번째 줄:
     console.log(error);
     console.log(error);
   });
   });
</source>
</syntaxhighlight>


==예시: POST 요청==
==예시: POST 요청==
<source lang='javascript'>
<syntaxhighlight lang='javascript'>
axios.post('/user', {
axios.post('/user', {
     firstName: 'Fred',
     firstName: 'Fred',
39번째 줄: 39번째 줄:
     console.log(error);
     console.log(error);
   });
   });
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:52 기준 최신판

1 개요[ | ]

Axios
  • 브라우저 및 node.js用 Promise 기반 HTTP 클라이언트

2 예시: GET 요청[ | ]

axios.get('/user?ID=12345')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });
axios.get('/user', {
    params: {
      ID: 12345
    }
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

3 예시: POST 요청[ | ]

axios.post('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

4 같이 보기[ | ]

5 참고[ | ]

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