Graphene-JS is a Python library for building GraphQL schemas/types fast and easily.
- Easy to use: Graphene helps you use GraphQL in Javascript without effort.
- Relay: Graphene has builtin support for Relay. (on the works)
- Data agnostic: Graphene supports any kind of data source: SQL (Sequelize), NoSQL, custom objects, etc. We believe that by providing a complete API you could plug Graphene-JS anywhere your data lives and make your data available through GraphQL.
Graphene has multiple integrations with different frameworks:
integration | Package |
---|---|
Sequelize | On the works! |
Also, Graphene is fully compatible with the GraphQL spec, working seamlessly with all GraphQL clients, such as Relay, Apollo and gql.
For instaling graphene, just run this command in your shell
npm install --save graphene-js
Here is one example for you to get started:
import * as graphene from "graphene";
class Query extends graphene.ObjectType {
static fields = {
hello: new graphene.String()
};
hello() {
return "Hello world!";
}
}
const schema = new Schema(Query);
Then Querying graphene.Schema
is as simple as:
query = `
query SayHello {
hello
}
`
var result = await schema.execute(query)
If you want to learn even more, you can also check the following examples:
- Basic Schema: Starwars example
- Basic Schema (Typescript): Starwars Relay example
After cloning this repo, ensure dependencies are installed by running:
npm i
After developing, the full test suite can be evaluated by running:
npm test
On the works