Conversation
1 similar comment
Jannis
left a comment
There was a problem hiding this comment.
I'd recommend separating the GraphiQL configuration parameters from the handler configuration a bit. Apart from that this looks great!
| Pretty bool | ||
| GraphiQL bool | ||
| EndpointURL string | ||
| SubscriptionsEndpoint string |
There was a problem hiding this comment.
Instead of making EndpointURL and SubscriptionsEndpoint top-level configuration fields, it would probably be cleaner to group them under a GraphiQLConfig field that can optionally be passed in together with GraphiQL: true. Example:
handler.New(&handler.Config{
Schema: ...,
GraphiQL: true,
GraphiQLConfig: &handler.GraphiQLConfig{
Endpoint: ...,
SubscriptionsEndpoint: ...,
}
})There was a problem hiding this comment.
I noticed that the Apollo server code for GraphiQL mentioned in #31 has a few more configuration variables that might make sense to add here (like additional HTTP headers to be passed to the endpoint for e.g. authentication).
graphiql.go
Outdated
| OperationName string | ||
| EndpointURL template.URL | ||
| EndpointURLWS template.URL | ||
| SubscriptionsEndpoint template.URL |
There was a problem hiding this comment.
Only EndpointURLWS is being used in the template, SubscriptionsEndpoint isn't. I personally favor the name SubscriptionsEndpoint and would pass Endpoint and SubscriptionsEndpoint (falling back to Endpoint if not set) in to the template.
1 similar comment
|
Thanks for your reviews. If I use a pointer for And if I use a plain What should I do? |
|
@kivutar What's the status on this one ? I'd be really interested in having this feature available. 😄 |
Attempt to address #31
Websocket subscriptions are now working.