graphql / graphiql

GraphiQL & the GraphQL LSP Reference Ecosystem for building browser & IDE tools.
MIT License
16.06k stars 1.72k forks source link

Possible to work without a backend Graphql server? #180

Closed rvenugopal closed 7 years ago

rvenugopal commented 7 years ago

Is there any way that this can work without a backend graphql server?
Probably related to #179.

For background, I am working on an app which has a complex DSL and I would like to help the end user with Autocompletion, docs and hints in an editor similar to what Graphiql does but I want to it to be completely local only.

asiandrummer commented 7 years ago

Hi @rvenugopal - to answer your question first, I think you can. graphql-js provides ways to execute/validate queries and etc, and the server (in a very simple world) uses those exported functions to do what you need to do. You should be able to write a fetcher function that runs the execution process via graphql-js and pass it locally to GraphiQL when it mounts. As you may know, this will potentially be an expensive work depending on the size of your query/schema, so please be aware of that.

I've been talking to people offline about this - I'm working to provide a GraphQL language service library that you might be interested in. The idea is to provide a GraphiQL-like experience to other IDEs by exposing an API/interface that you can extend and implement in your editor of choice. Would this be closer to what you want?

rvenugopal commented 7 years ago

@asiandrummer

Thanks for the info about graphql-js. Yes, exposing an API sounds great. Thank you

asiandrummer commented 7 years ago

No worries - I'll keep everyone updated with the language service progress!