Browse Source

remove: graphiql form subject

pull/795/head
lee 3 years ago
parent
commit
03dd595b18
  1. 4
      subjects/graphql/README.md
  2. 36
      subjects/graphql/index.html

4
subjects/graphql/README.md

@ -48,7 +48,7 @@ for example: [github-pages](https://pages.github.com/), [netlify](https://www.ne
### Usage
> To test your queries you can access the GraphQL IDE on _https://((DOMAIN))/public/subjects/graphql/_ or create your own [**GraphiQL Docs**](https://github.com/graphql/graphiql). This will give you a bigger picture of the tables, attributes and all the types of queries that you can do.
> To test your queries you can access the GraphQL IDE on _https://((DOMAIN))/graphql/_ or create your own [**GraphiQL Docs**](https://github.com/graphql/graphiql). This will give you a bigger picture of the tables, attributes and all the types of queries that you can do.
Here are the list of tables that you are allowed to query (it will be only provided the columns present on the tables):
@ -152,7 +152,7 @@ You can see the result using `curl`:
- `curl "https://((DOMAIN))/api/graphql-engine/v1/graphql" --data '{"query":"{user(where:{id:{_eq:6}}){id login}}"}'`
In graphQL the usage of arguments can be specified in the schema of the API. Like said above you can visit the _docs_ for the graphQL endpoint, _https://((DOMAIN))/public/subjects/grapqhl_
In graphQL the usage of arguments can be specified in the schema of the API. Like said above you can visit the _docs_ for the graphQL endpoint, _https://((DOMAIN))/grapqhl_
Example of nesting, using the result and user table :

36
subjects/graphql/index.html

@ -1,36 +0,0 @@
<html>
<head>
<title>GraphiQL</title>
<link href="https://unpkg.com/graphiql/graphiql.min.css" rel="stylesheet" />
</head>
<body style="margin: 0;">
<div id="graphiql" style="height: 100vh;"></div>
<script
crossorigin
src="https://unpkg.com/react/umd/react.production.min.js"
></script>
<script
crossorigin
src="https://unpkg.com/react-dom/umd/react-dom.production.min.js"
></script>
<script
crossorigin
src="https://unpkg.com/graphiql/graphiql.min.js"
></script>
<script>
const graphQLFetcher = graphQLParams =>
fetch(`https://${location.hostname}/api/graphql-engine/v1/graphql`, {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(graphQLParams),
})
.then(response => response.json().catch(() => response.text()))
ReactDOM.render(
React.createElement(GraphiQL, { fetcher: graphQLFetcher }),
document.getElementById('graphiql'),
)
</script>
</body>
</html>
Loading…
Cancel
Save