๐ŸŸก ๋ฐ์ดํ„ฐ ํ†ต์‹ 

**์„ธํŒ…**

ํŒจํ‚ค์ง€ -> server ํด๋” ์—์„œ ํ†ตํ•ฉ ํ„ฐ๋ฏธ๋„ ์—ด๊ธฐ ->
`npm init -y`
`npm install express` ์ž…๋ ฅ ->

`node server.js` ์‹คํ–‰

1. Axios๋ž€?

<aside> ๐Ÿ’ก

๋ธŒ๋ผ์šฐ์ €์™€ Node.js์—์„œ HTTP ์š”์ฒญ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” Promise ๊ธฐ๋ฐ˜์˜ JavaScript ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

</aside>


2. ์„ค์น˜ ๋ฐฉ๋ฒ•

npm ์‚ฌ์šฉ ์‹œ

npm install axios

3. ๊ธฐ๋ณธ ์‚ฌ์šฉ๋ฒ•

GET ์š”์ฒญ

import axios from 'axios';

axios.get('<https://api.example.com/users>')
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error(error);
  });

POST ์š”์ฒญ

axios.post('<https://api.example.com/users>', {
  name: '๋ฏผ์„ฑ',
  age: 25
})
.then(response => {
  console.log(response.data);
})
.catch(error => {
  console.error(error);
});

4. ๊ณตํ†ต ์„ค์ • (๊ธฐ๋ณธ๊ฐ’ ์ง€์ •)

axios.defaults.baseURL = '<https://api.example.com>';
axios.defaults.headers.common['Authorization'] = 'Bearer TOKEN';