Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback for “Basic Types” #4330

Open
eldoy opened this issue Jan 17, 2025 · 1 comment
Open

Feedback for “Basic Types” #4330

eldoy opened this issue Jan 17, 2025 · 1 comment

Comments

@eldoy
Copy link

eldoy commented Jan 17, 2025

This part of your documentation is kind of worthless:

var app = express()
app.all(
  "/graphql",
  createHandler({
    schema: schema,
    rootValue: root,
  })
)
app.listen(4000)

Why do you keep repeating that in every example? The source should be there instead, the actual query. I don't use express and never will, and you're hiding how it actually works behind thie createHandler function.

@benjie benjie transferred this issue from graphql/graphql.github.io Jan 18, 2025
@JoviDeCroock
Copy link
Member

This is good feedback, the main reason for this repetition is to make examples copy and past-able without having to keep all prior examples as context. There are good reasons for using express, it's general purpose and as mentioned before, graphql-http builds on top of all these major frameworks.

We are purposefully not picking apollo-server or graphql-yoga to make these examples, instead we use something that is destined to be spec-compliant with GraphQL Over HTTP as we maintain this ourselves.

The main complexity with removing the handler code is that we'd have to implement our own server in a lot of these pages which isn't really our intention as that would need us to implement every spec detail of GraphQL Over HTTP. We could remove the HTTP requirement but that would make a lot of these demo's less useful as they wouldn't expose the data-transfer part of GraphQL.

The main thing we want to show is how to create types, the exemplification of setting up the server is more so that people can actually play with it, having considered all of that I gravitate towards leaving the operational aspect of the examples in place personally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants