-
Notifications
You must be signed in to change notification settings - Fork 2
/
voyager.html
50 lines (48 loc) · 1.27 KB
/
voyager.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
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<style>
body {
height: 100%;
margin: 0;
width: 100%;
overflow: hidden;
}
#voyager {
height: 100vh;
}
</style>
<!--
These two files are served from jsdelivr CDN, however you may wish to
copy them directly into your environment, or perhaps include them in your
favored resource bundler.
-->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.css"
/>
<script src="https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.standalone.js"></script>
</head>
<body>
<div id="voyager">Loading...</div>
<script>
const { init, voyagerIntrospectionQuery: query } = GraphQLVoyager;
const introspection = fetch(
'/gql',
{
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({ query }),
// credentials: 'omit',
},
).then((response) => response.json());
// Render <Voyager /> into the body.
GraphQLVoyager.renderVoyager(document.getElementById('voyager'), {
introspection,
});
</script>
</body>
</html>