File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -468,6 +468,53 @@ const client = createClient({
468
468
469
469
</details >
470
470
471
+ <details id =" browser " >
472
+ <summary ><a href =" #browser " >🔗</a > Client usage in browser</summary >
473
+
474
+ ``` html
475
+ <!DOCTYPE html>
476
+ <html >
477
+ <head >
478
+ <meta charset =" utf-8" />
479
+ <title >GraphQL over HTTP</title >
480
+ <script
481
+ type =" text/javascript"
482
+ src =" https://unpkg.com/graphql-http/umd/graphql-http.min.js"
483
+ ></script >
484
+ </head >
485
+ <body >
486
+ <script type =" text/javascript" >
487
+ const client = graphqlHttp .createClient ({
488
+ url: ' http://umdfor.the:4000/win/graphql' ,
489
+ });
490
+
491
+ // consider other recipes for usage inspiration
492
+ </script >
493
+ </body >
494
+ </html >
495
+ ```
496
+
497
+ </details >
498
+
499
+ <details id =" node-client " >
500
+ <summary ><a href =" #node-client " >🔗</a > Client usage in Node</summary >
501
+
502
+ ``` js
503
+ const fetch = require (' node-fetch' ); // yarn add node-fetch
504
+ const { AbortController } = require (' node-abort-controller' ); // (node < v15) yarn add node-abort-controller
505
+ const { createClient } = require (' graphql-sse' );
506
+
507
+ const client = createClient ({
508
+ url: ' http://no.browser:4000/graphql' ,
509
+ fetchFn: fetch,
510
+ abortControllerImpl: AbortController, // node < v15
511
+ });
512
+
513
+ // consider other recipes for usage inspiration
514
+ ```
515
+
516
+ </details >
517
+
471
518
<details id =" auth " >
472
519
<summary ><a href =" #auth " >🔗</a > Server handler usage with authentication</summary >
473
520
You can’t perform that action at this time.
0 commit comments