Skip to content

Commit 23bd9c9

Browse files
committed
update the highest traffic examples
1 parent 19add23 commit 23bd9c9

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

examples/graphiql-cdn/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# GraphiQL CDN Example
22

3-
This example uses the CDN bundles to show the most simple example possible. It
4-
uses the latest version published on npm, via unpkg
3+
This example uses the CDN bundles to show a simple graphiql example, with explorer plugin.
4+
5+
It uses the latest version published on npm, via unpkg
56

67
### Setup
78

examples/graphiql-cdn/index.html

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@
3737
crossorigin
3838
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
3939
></script>
40-
40+
<script
41+
src="https://unpkg.com/graphiql/graphiql.min.js"
42+
type="application/javascript"
43+
></script>
44+
<script
45+
src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js"
46+
crossorigin
47+
></script>
4148
<!--
4249
These two files can be found in the npm module, however you may wish to
4350
copy them directly into your environment, or perhaps include them in your
@@ -48,18 +55,18 @@
4855

4956
<body>
5057
<div id="graphiql">Loading...</div>
51-
<script
52-
src="https://unpkg.com/graphiql/graphiql.min.js"
53-
type="application/javascript"
54-
></script>
5558
<script>
5659
const root = ReactDOM.createRoot(document.getElementById('graphiql'));
60+
const fetcher = GraphiQL.createFetcher({
61+
url: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
62+
headers: { 'X-Example-Header': 'foo' },
63+
});
64+
const explorerPlugin = GraphiQLPluginExplorer.explorerPlugin();
5765
root.render(
5866
React.createElement(GraphiQL, {
59-
fetcher: GraphiQL.createFetcher({
60-
url: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
61-
}),
67+
fetcher,
6268
defaultEditorToolsVisibility: true,
69+
plugins: [explorerPlugin],
6370
}),
6471
);
6572
</script>

packages/graphiql-plugin-explorer/examples/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
crossorigin="anonymous"
4848
></script>
4949
<script
50-
src="https://unpkg.com/@graphiql/plugin-explorer@0.1.12/dist/index.umd.js"
50+
src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js"
5151
integrity="sha512-Fjas/uSkzvsFjbv4jqU9nt4ulU7LDjiMAXW2YFTYD96NgKS1fhhAsGR4b2k2VaVLsE29aia3vyobAq9TNzusvA=="
5252
crossorigin="anonymous"
5353
></script>

0 commit comments

Comments
 (0)