Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit e5a3c52

Browse files
authored
Update README.md
1 parent 8f08023 commit e5a3c52

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,36 @@ You may publish the configuration and/or the views:
3131
## Usage
3232

3333
By default, the playground is reachable at `/graphql-playground`
34+
and assumes a running GraphQL endpoint at `/graphql`.
3435

35-
It assumes a running GraphQL endpoint at `/graphql`. You can enter another URL in the
36-
UI or change the default setting in the configuration file.
36+
If your endpoint is located somewhere else, you can change the setting
37+
in the published `config/graphql-playground.php`:
38+
39+
```php
40+
'endpoint' => 'any-url.com/route',
41+
```
42+
43+
If you want to change arbitrary options of the UI, you can publish the view
44+
and add [possible settings to the playground instance](https://github.com/prisma/graphql-playground#properties),
45+
for example:
46+
47+
```php
48+
<div id="root" />
49+
<script type="text/javascript">
50+
window.addEventListener('load', function (event) {
51+
const loadingWrapper = document.getElementById('loading-wrapper');
52+
loadingWrapper.classList.add('fadeOut');
53+
const root = document.getElementById('root');
54+
root.classList.add('playgroundIn');
55+
GraphQLPlayground.init(root, {
56+
endpoint: "{{url(config('graphql-playground.endpoint'))}}",
57+
settings: {
58+
'request.credentials': 'same-origin',
59+
},
60+
})
61+
})
62+
</script>
63+
```
3764

3865
### Local assets
3966

0 commit comments

Comments
 (0)