๐ด Introduction
โช ๋ธ๋ผ์ฐ์ , Node.js๋ฅผ ์ํ Promise API๋ฅผ ํ์ฉํ๋ HTTP ๋น๋๊ธฐ ํต์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
๐ Official
๐ก Install
npm i axios
๐ข Usage
import axios from "axios";
const BASE_URL = `https://api.coinpaprika.com/v1`;
export const fetchCoins = async () => {
// ๐ก get์ผ๋ก ๋ฐ์์จ json ๋ฐ์ดํฐ๋ฅผ ๋ฐ๋ก jsonํ ์์ผ์ค๋ค.
return await axios.get(`${BASE_URL}/coins`).then((response) => response.data);
};
'React > Library' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ React ] react-helmet (0) | 2022.07.30 |
---|---|
[ React ] recoil (0) | 2022.07.30 |
[ React ] apexchart (0) | 2022.07.30 |
[ React ] @tanstack/react-query (0) | 2022.07.30 |
[ React ] styled-components (0) | 2022.07.18 |