This blog post was originally published on Medium by Michael Hunger and is used with permission.

Graphcool released it’s GraphQL command-line tools two days ago, so I thought it would be nice to see how well they work, especially with our Neo4j GraphQL backend. And here’s the good news : pretty well.

You can see a quick demo below which this article will explain in detail.

Learn from this initial test of the GraphQL command-line interface when used alongside Neo4j

So installing is easy, it’s just npm install -g graphql-cli, which makes a graphql command available. The tools make use of graphql-config, a consistent way of storing endpoints and related configuration information in YAML or JSON, which is specified here.

Here is a quick overview of the commands available:

Example GraphQL Backend

As an example for my tests of the GraphQL command-line interface, I’ll use my Game of Thrones GraphQL backend.

The Neo4j-GraphQL backend using a Game of Thrones dataset

(If you just want to test it out, you can also just run npm install -g neo4j-graphql-cli && neo4j-graphql to spin up the default movie database backend.)

After spinning up my Game of Thrones instance I find this connection information on my Neo4j Sandbox UI:

Neo4j Sandbox and GraphQL API endpoint

GraphQL-CLI Setup

So I can just run graphql init, which then nicely asks me for these things:

Authentication Headers !?!

All good so far. But when I try to run graphql ping I get this error message, which means that (of course) my authentication header is missing.

Unfortunately at 3 a.m. I didn’t think about looking through the graphql-config spec, so I delved into the code of graphql-cli and then graphql-config, looking for a place to add header information.

Read the rest of Michael’s post on Medium where he covers plugin options, schema feching and altering current schemas.

Want to learn more about graph databases and Neo4j? Click below to register for our free online training class, Introduction to Graph Databases and master the world of graph technology in no time.

Sign Me Up



About the Author

Michael Hunger , Developer Relations

Michael Hunger Image

Michael Hunger has been passionate about software development for a very long time. For the last few years he has been working on the open source Neo4j graph database filling many roles.

As caretaker of the Neo4j community and ecosystem he especially loves to work with graph-related projects, users and contributors. As a developer, Michael enjoys many aspects of programming languages, learning new things every day, participating in exciting and ambitious open source projects and contributing and writing software related books and articles.

1 Comment

ajanda says:

thank you for sharing and narration.

Leave a Reply

Your email address will not be published. Required fields are marked *


Upcoming Event


Have a Graph Question?

Stack Overflow
Community Forums
Contact Us

Share your Graph Story?

Email us: