Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi,
Since express-graphql is deprecated can we still use graphiql explorer with the new graphql-http as replacement?

You must be logged in to vote

I think the question is more whether the library ships with GraphiQL integrated. @ShueiYang that it does not and it never will, graphql-http is a reference implementation of the GraphQL over HTTP specification and as such follows the specification strictly without any additional features (see disclaimer in readme).

You can of course intercept the incoming requests and render GraphiQL whenever you wish.

Replies: 4 comments · 7 replies

Comment options

Yes, GraphiQL Explorer should work against any valid GraphQL API, I don't think it actually cares about the transport at all - it's schema/editor only.

You must be logged in to vote
0 replies
Comment options

Ok thanks, because I do a quick test in localhost with http://localhost:3000/graphql it give me an error "message": "Missing query"

You must be logged in to vote
0 replies
Comment options

I think the question is more whether the library ships with GraphiQL integrated. @ShueiYang that it does not and it never will, graphql-http is a reference implementation of the GraphQL over HTTP specification and as such follows the specification strictly without any additional features (see disclaimer in readme).

You can of course intercept the incoming requests and render GraphiQL whenever you wish.

You must be logged in to vote
4 replies
@d-volution
Comment options

You can of course intercept the incoming requests and render GraphiQL

OK, but how to do that? Yes I am kind of a noob, but I would appreciate some hint or a weblink to a tutorial or whatever.
Do I have to write a whole GraphiQL renderer for myself?

Thanks in advance!

@ShueiYang
Comment options

I am also a beginner at GraphQL, all i can say is since the main goal from graphql-http is to do only what it should do, I simply use Postman to test some query since they support now graphql query. If you need more advanced feature like graphiQL you can for example just add and use graph-client to use graphiQL, there is also bigger library like Apollo-server which integrated their own Graphiql rendering. (Already link by enisdenjo in the readme)

@enisdenjo
Comment options

That is a fair point guys, let me see what I can do here. 🤔

@benjie
Comment options

You can also mount a pre-packaged GraphiQL into your server separate from graphql-http. Ruru for example can be rendered via basically any Node server.

Answer selected by ShueiYang
Comment options

Regarding graphiql's disclaimer, is there an alternative?
There is no solution?

You must be logged in to vote
3 replies
@enisdenjo
Comment options

You can always use one of more feature-full servers, like GraphQL Yoga. It offers a lot of things out-of-the box, things like subscriptions, caching, GraphiQL explorer, etc.

@ElginHarten
Comment options

Ran into the same problem, but it turned out to be straightforward to add back the same or equivalent functionality. I opted to install playground instead of GraphiQL this time around. This is how I do it using express:

`
import { createHandler } from 'graphql-http/lib/use/express';
const expressPlayground = require('graphql-playground-middleware-express').default

app.use('/graphql', createHandler({ schema: schema }));
app.get('/playground', expressPlayground({ endpoint: '/graphql' }));
`

This works for a simple hello world schema. I haven't figured out how to connect with my neo4j driver. If anyone can provide some hints, please share. Hope this works for you.

@ElginHarten
Comment options

For anyone interested, the solution for hooking neo4j driver is to craft your createHandler statement like so:

app.use('/graphql', createHandler({ schema: schema, context: (req) => ({ req, executionContext: driver }) }));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.