0
GraphQL 끝점에서 일부 데이터를 가져 오려고하지만 "계속 쿼리 문자열을 제공해야합니다."라는 오류 메시지가 계속 나타납니다. 쿼리 문자열을 제공한다고 확신합니다.이 오류는 어디서 발생 했습니까?GraphQL API에서 가져올 쿼리 문자열 제공
엔드 포인트는 다음과 같습니다이 경우 https://antserver-blocjgjbpw.now.sh/graphql
const query = `{
ants {
name
color
length
weight
}
}`
document.getElementById("basicFetchButton").addEventListener("click",() => {
\t fetch("https://antserver-blocjgjbpw.now.sh/graphql", {
\t method: 'POST',
\t \t 'Content-Type': 'application/graphql',
body: JSON.stringify({query})
})
.then(res => res.json())
.then(data => console.log(data))
})