GraphQL started being developed internally at Facebook back in 2012, before being publicly released as open-source in 2015. GraphQL is a query language for APIs, its main advantage is allowing clients to query exactly for the type of data that is required. The definitions of all the data clients can query through the service are stored in GraphQL schema. Each field in the schema is attached to a function, called a resolver, which gets called to produce the values when a query is executed.
GraphQL is language-agnostic which makes it fairly easy to be adopted across different technologies, one of its successful implementations is done in Rust, by a library called Juniper.
Juniper is a code-first approach that allows you to write type-safe and super fast GraphQL servers in Rust, keeping declaring and resolving GraphQL schemas as easy as possible.
GraphQL query language is fully supported, including interfaces, unions, schema introspection, validations, as well as some basic Rust crates integrations allowing you to use popular Rust types as
bson out of the box.
As previously mentioned Juniper is a code-first library, if you prefer the schema-first approach you can use juniper-from-schema to auto-generate resolvers for your GraphQL schema.
Although Juniper does not provide a built-in web server functionality it comes with building blocks to make integration with your servers as seamless as possible, as well as optionally providing pre-built integration for popular Rust web frameworks like:
Below you can find a sample Juniper integration with the Actix web framework. The servers run on
127.0.0.1:8080 and has built-in GraphiQL for easier testing. Star it with:
cd examples/juniper cargo run (or ``cargo watch -x run``)
If you are looking for more advanced usage examples make sure to visit juniper-advanced example repo.
The GraphQL Editor is a supportive tool for both advanced GraphQL users as well as those taking their first steps with GraphQL APIs. Our all-in-one development environment for GraphQL will help you build, manage & deploy your GraphQL API much faster thanks to dozens of built-in micro features. Its graphical interface will also fix communication within your product team. Visualization is the key!