@@ -62,69 +62,13 @@ You can get GraphQL Voyager bundle from the following places:
62
62
- latest version - https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.standalone.js
63
63
- from ` dist ` folder of the npm package ` graphql-voyager `
64
64
65
- ** The HTML with minimal setup** (see the full [ example] ( ./example/cdn ) )
66
-
67
- ``` html
68
- <!DOCTYPE html>
69
- <html >
70
- <head >
71
- <link
72
- rel =" stylesheet"
73
- href =" https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.css"
74
- />
75
- <script src =" https://cdn.jsdelivr.net/npm/graphql-voyager/dist/voyager.standalone.js" ></script >
76
- </head >
77
- <body >
78
- <div id =" voyager" >Loading...</div >
79
- <script >
80
- // do a call to server using voyagerIntrospectionQuery provided
81
- const query = GraphQLVoyager .voyagerIntrospectionQuery ;
82
- const introspection = fetch (' <server url>' , {
83
- method: ' post' ,
84
- headers: {
85
- Accept: ' application/json' ,
86
- ' Content-Type' : ' application/json' ,
87
- },
88
- body: JSON .stringify ({ query }),
89
- // ...
90
- }).then ((response ) => response .json ());
91
- // or just return pre-fetched introspection
92
-
93
- // Render <Voyager />
94
- GraphQLVoyager .init (document .getElementById (' voyager' ), {
95
- introspection: introspection,
96
- });
97
- </script >
98
- </body >
99
- </html >
100
- ```
65
+ ** The HTML example** : [ example/cdn/index.html] ( ./example/cdn/index.html ) )
101
66
102
67
### Using as a dependency
103
68
104
- You can install lib:
105
-
106
- npm i --save graphql-voyager
107
-
108
- And then use it:
109
-
110
- ``` js
111
- import * as React from ' react' ;
112
- import * as ReactDOM from ' react-dom' ;
113
- import { Voyager , voyagerIntrospectionQuery } from ' graphql-voyager' ;
114
-
115
- const introspection = fetch (window .location .origin + ' /graphql' , {
116
- method: ' post' ,
117
- headers: { ' Content-Type' : ' application/json' },
118
- body: JSON .stringify ({ query: voyagerIntrospectionQuery }),
119
- }).then ((response ) => response .json ());
120
-
121
- ReactDOM .render (
122
- < Voyager introspection= {introspection} / > ,
123
- document .getElementById (' voyager' ),
124
- );
125
- ```
69
+ Build for the web with [ webpack] ( https://webpack.js.org/ ) , or any other bundle.
126
70
127
- Build for the web with [ webpack] ( https://webpack.js.org/ ) , see ( [ example] ( ./example/webpack-example ) )
71
+ ** The minimal webpack setup ** : [ example/webpack ] ( ./example/webpack ) )
128
72
129
73
## Middleware
130
74
0 commit comments