json-graphql-server icon indicating copy to clipboard operation
json-graphql-server copied to clipboard

GraphiQL set up incorrectly according to docs

Open jaa134 opened this issue 1 year ago • 7 comments

What you were expecting: Docs clearly say to register your express server handler at /graphql. Then GraphiQL should work once the server starts.

What happened instead: GraphiQL loads index.html, but fails to fetch schema or make requests. All requests 404 as they are directed at the wrong handler path.

Steps to reproduce:

  1. Register express server handler using /graphql as path like docs say.
  2. Build/start express server.
  3. Open GraphiQL in web browser
  4. Notice that schema cannot be fetched and queries/mutations fail.

Related code: See:

  • here --> Should be \graphql or configurable to match a custom path
  • here --> Should be removed

More info GraphiQL is making requests to the wrong express handler due to a misconfiguration. If I register the handler at the base express path /, then it works fine.

Environment Node

jaa134 avatar Jul 31 '24 18:07 jaa134

@djhi Related to #177

jaa134 avatar Jul 31 '24 18:07 jaa134

@djhi Why was this closed? The new GraphiQL handler is still broken.

jaa134 avatar Aug 01 '24 16:08 jaa134

Read too fast...

djhi avatar Aug 01 '24 16:08 djhi

You can open PRs by the way :)

djhi avatar Aug 01 '24 16:08 djhi

Doing it now! Give me 2 seconds :)

jaa134 avatar Aug 01 '24 16:08 jaa134

@djhi I seem to not have the power to make a branch. Can you give me permissions?

jaa134 avatar Aug 01 '24 16:08 jaa134

You have to fork the repo, make your change on your fork and you should then have a button to submit a PR :)

djhi avatar Aug 01 '24 17:08 djhi