2015-11-21 21:33:29 +03:00
|
|
|
---
|
|
|
|
path: /
|
|
|
|
---
|
2015-11-28 11:19:54 +03:00
|
|
|
<div class="starwars-example-wrapper"><a class="starwars-example" href="http://swapi.graphene-python.org/">Check our Django Starwars API example!</a></div>
|
2015-11-21 21:33:29 +03:00
|
|
|
|
2016-05-29 09:07:27 +03:00
|
|
|
|
|
|
|
<div>
|
|
|
|
<div class="homepage-intro">
|
|
|
|
|
2015-11-26 09:58:43 +03:00
|
|
|
## Meet Graphene
|
2015-11-21 21:33:29 +03:00
|
|
|
|
2016-05-29 09:07:27 +03:00
|
|
|
Graphene is a Python library for building *GraphQL* schemas/types fast and easily.
|
|
|
|
|
|
|
|
|
|
|
|
* **Easy to use**: Graphene helps you use *GraphQL* in Python easily.
|
|
|
|
* Graphene has **builtin support for Relay**.
|
|
|
|
* Support for **Django**, **SQLAlchemy** and **GAE**: mapping the models automatically to *GraphQL* types.
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="homepage-schema">
|
|
|
|
|
|
|
|
```python
|
|
|
|
import graphene
|
|
|
|
|
|
|
|
class Query(graphene.ObjectType):
|
|
|
|
hello = graphene.String()
|
|
|
|
|
|
|
|
def resolve_hello(self, args, info):
|
|
|
|
return 'world'
|
|
|
|
|
|
|
|
schema = graphene.Schema(query=Query)
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
result = schema.execute('{ hello }')
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
#### What is GraphQL?
|
|
|
|
*GraphQL* is a data query language and runtime designed to request and deliver data in a performant way.
|
2015-11-21 21:33:29 +03:00
|
|
|
|
2016-05-29 09:07:27 +03:00
|
|
|
Advantages of using *GraphQL*:
|
|
|
|
* Only **one API endpoint**. One roundtrip for fetch everything you need.
|
|
|
|
* No data overfetching or underfetching.
|
|
|
|
* Autogenerated Graphical UI and docs based in your schema.
|
|
|
|
<div>
|