|
| 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 | + |
| 19 | + #graphiql { |
| 20 | + height: 100vh; |
| 21 | + } |
| 22 | + </style> |
| 23 | + |
| 24 | + <!-- |
| 25 | + This GraphiQL example depends on Promise and fetch, which are available in |
| 26 | + modern browsers, but can be "polyfilled" for older browsers. |
| 27 | + GraphiQL itself depends on React DOM. |
| 28 | + If you do not want to rely on a CDN, you can host these files locally or |
| 29 | + include them directly in your favored resource bundler. |
| 30 | + --> |
| 31 | + <script |
| 32 | + crossorigin |
| 33 | + src="https://unpkg.com/react@17/umd/react.development.js" |
| 34 | + ></script> |
| 35 | + <script |
| 36 | + crossorigin |
| 37 | + src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" |
| 38 | + ></script> |
| 39 | + |
| 40 | + <!-- |
| 41 | + These two files can be found in the npm module, however you may wish to |
| 42 | + copy them directly into your environment, or perhaps include them in your |
| 43 | + favored resource bundler. |
| 44 | + --> |
| 45 | + <link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" /> |
| 46 | + </head> |
| 47 | + |
| 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 | + ReactDOM.render( |
| 56 | + React.createElement(GraphiQL, { |
| 57 | + fetcher: GraphiQL.createFetcher({ |
| 58 | + url: 'http://localhost:5000/graphql', |
| 59 | + subscriptionUrl: 'ws://localhost:5000/graphql' |
| 60 | + }), |
| 61 | + defaultEditorToolsVisibility: true, |
| 62 | + }), |
| 63 | + document.getElementById('graphiql'), |
| 64 | + ); |
| 65 | + </script> |
| 66 | + </body> |
| 67 | +</html> |
0 commit comments