@txstate-mws/graphql-server
Version:
A simple graphql server designed to work with typegraphql.
29 lines (26 loc) • 983 B
HTML
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/react@16/umd/react.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@16/umd/react-dom.production.min.js"></script>
<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.min.js"></script>
</head>
<body>
<div id="voyager">Loading...</div>
<script>
async function introspectionProvider(introspectionQuery) {
const resp = await fetch('GRAPHQL_ENDPOINT', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({query: introspectionQuery}),
})
return resp.json()
}
// Render <Voyager />
GraphQLVoyager.init(document.getElementById('voyager'), {
introspection: introspectionProvider
})
</script>
</body>
</html>