svelte has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present

라헬·2023년 3월 19일
0

svelte로 api 요청하다가 이런 에러를 발견했을때
쉽게 해결할 수 있는 방법을 찾았다

export const loadMembers = () => {
return fetch(baseurl, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
mode: 'cors',
}).then((res) => res.json())
}

바로 mode: 'cors'를 넣어주면 되는 것......!!!!
정말 간단하다
츄라이츄라이

profile
성장하고 싶은 풀스택 개발자

0개의 댓글