graphiql.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!--
  2. * Copyright (c) 2021 GraphQL Contributors
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. -->
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <style>
  12. body {
  13. height: 100%;
  14. margin: 0;
  15. width: 100%;
  16. overflow: hidden;
  17. }
  18. #graphiql {
  19. height: 100vh;
  20. }
  21. </style>
  22. <script
  23. type="text/javascript"
  24. src="https://unpkg.com/graphql-ws/umd/graphql-ws.min.js"
  25. ></script>
  26. <!--
  27. This GraphiQL example depends on Promise and fetch, which are available in
  28. modern browsers, but can be "polyfilled" for older browsers.
  29. GraphiQL itself depends on React DOM.
  30. If you do not want to rely on a CDN, you can host these files locally or
  31. include them directly in your favored resource bunder.
  32. -->
  33. <script
  34. crossorigin
  35. src="https://unpkg.com/react@17/umd/react.development.js"
  36. ></script>
  37. <script
  38. crossorigin
  39. src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"
  40. ></script>
  41. <!--
  42. These two files can be found in the npm module, however you may wish to
  43. copy them directly into your environment, or perhaps include them in your
  44. favored resource bundler.
  45. -->
  46. <link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
  47. </head>
  48. <body>
  49. <div id="graphiql">Loading...</div>
  50. <script
  51. src="https://unpkg.com/graphiql/graphiql.min.js"
  52. type="application/javascript"
  53. ></script>
  54. <script>
  55. const fetcher = GraphiQL.createFetcher({
  56. url: 'https://whaley.diffey.dev/backend/graphql',
  57. wsClient: graphqlWs.createClient({
  58. url: 'wss://whaley.diffey.dev/backend/graphql',
  59. }),
  60. });
  61. ReactDOM.render(
  62. React.createElement(GraphiQL, {
  63. fetcher,
  64. defaultVariableEditorOpen: true,
  65. }),
  66. document.getElementById('graphiql'),
  67. );
  68. </script>
  69. </body>
  70. </html>