๐Ÿ‘จ‍๐Ÿ’ป kimtongting
article thumbnail
[React] Axios / React API ํ†ต์‹  (๋ฆฌ์•กํŠธ api ํ†ต์‹ )

axios ๋ชจ๋“ˆํ™” axios๋Š” ํ†ต์‹ ์œผ๋กœ ํ•œ ๊ณณ์—์„œ๋งŒ ์“ฐ์ด๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์—, ์œ ์ง€๋ณด์ˆ˜ ๋ฐ ๊ฐ€๋…์„ฑ์„ ์œ„ํ•ด ๋ชจ๋“ˆํ™”๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์ด์ „ ๊ธ€์—์„œ ์ž‘์„ฑํ•œ ํ”„๋กœ์ ํŠธ ๋””๋ ‰ํ† ๋ฆฌ ๊ตฌ์„ฑ์— ๋”ฐ๋ผ, 'utils' ๋””๋ ‰ํ† ๋ฆฌ์— api.js ๋ผ๋Š” react.js ๋ฅผ ์ƒ์„ฑํ•ด์„œ ์—ฌ๋Ÿฌ ํŽ˜์ด์ง€์—์„œ ํ™œ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค. api.js ์„ ์–ธ import axios from 'axios'; const API =axios.create({ //baseURL: `http://localhost:8080/common`, timeout: 30000, headers: { "Content-Type" : `application/json;charset=UTF-8`, "Access-Control-Allow-Origin": "*", "Accept": "applicat..