This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This RFC adds an opt-in behavior of express-graphql to render a fully functional GraphiQL instance when loaded from a browser - determed as anything that prefers HTML over JSON from the Accept header.
GraphiQL mode is enabled by providing
graphiql: true
in the options bag. It defaults tofalse
which is a reasonable default, but also ensures any existing use updating to this version will not unknowingly add this feature. The examples in the README have been changed to enable GraphiQL, ideally all future users will leave this on, cargo-cult from README is likely.When GraphiQL is shown, the query result is run on the server first and presented immediately in the GraphiQL UI.
If you wish to use the browser as a cheap cURL, just add
&raw
to the end of the URL and GraphiQL is replaced by raw JSON output.One small detail: any non-GraphQL GET params provided will be carried through by GraphiQL when executing queries. Ideally this covers the majority of authentication cases which are likely to look something like
https://mysite/graphql?oauth=abc123&query={yo}
.