By Michael Hunger, Developer Relations | August 24, 2017 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.
So installing is easy, it’s just
npm install -g graphql-cli, which makes a
graphqlcommand 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.
(If you just want to test it out, you can also just run
npm install -g neo4j-graphql-cli && neo4j-graphqlto 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:
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 pingI 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-configspec, so I delved into the code of
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.
Sign Me Up
About the Author
Michael Hunger, Developer Relations
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.
From the CEO
Have a Graph Question?
Reach out and connect with the Neo4j staff.Stackoverflow
Share your Graph Story?
Email us: email@example.com