-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
37 lines (33 loc) · 945 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div id="output" style="white-space: pre-wrap; font-family: 'Cascadia Code', Consolas;"></div>
<script>
async function main() {
const response = await fetch("/api/droid", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
body: JSON.stringify({
query: `
{
hero {
name
}
}`})
});
console.log(response);
const json = await response.json();
console.log(json);
document.getElementById("output").innerHTML = JSON.stringify(json, null, 4);
}
main();
</script>
</body>
</html>