diff --git a/quickstart.md b/quickstart.md index f9b0f7a1..d74c7151 100644 --- a/quickstart.md +++ b/quickstart.md @@ -33,9 +33,36 @@ pip install graphene ## Types -First we're going to define some GraphQL ObjectTypes that we'll use in our `Schema`: +First we're going to define some GraphQL ObjectTypes for our `Schema`: -``` + +```python import graphene -``` \ No newline at end of file +schema = graphene.Schema() + +# This will be our root query +class Query(graphene.ObjectType): + username = graphene.StringField(description='The username') + + def resolve_username(self, *args): + return 'Hello World' + +# Here we set the root query for our schema +schema.query = Query +``` + +Then, we can start querying our schema: + +```python +result = schema.execute('{ username }') + +# result.data should be {'username': 'Hello World'} +username = result.data['username'] + +print(username) +``` + +Congrats! You got your first version of graphene working! + +**This Quickstart page needs to be improved, meanwhile visit the [schema](https://github.com/graphql-python/django-graphene-example/blob/master/starwars/schema.py) of our Starwars Django example!**