fetch1 [Javascript] Fetch API ✨ Fetch API 란? 원격 API를 호출할 수 있도록 하는 함수이며, 전달인자로 url 과 options 를 받는다. url 에는 API 주소를 입력하고, options 에는 request 내용을 세부적으로 추가한다. let url = 'http://something.com' let options = { method: 'POST', body: JSON.stringify({ username:"아이스", text:"아메리카노" }), headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } } fetch(url, options) .then((response) => console.log("response:", respons.. 2021. 5. 27. 이전 1 다음