@@ -8,44 +8,32 @@ Adds GraphQL support to your Flask application.
88Usage
99-----
1010
11- Just create a ``GraphQL `` instance from ``flask_graphql ``
11+ Just use the ``GraphQLView `` view from ``flask_graphql ``
1212
1313.. code :: python
1414
15- from flask_graphql import GraphQL
15+ from flask_graphql import GraphQLView
1616
17- graphql_blueprint = GraphQL(app , schema = schema)
17+ app.add_url_rule( ' /graphql ' , view_func = GraphQLView.as_view( ' graphql ' , schema = schema, graphiql = True ) )
1818
1919 This will add ``/graphql `` and ``/graphiql `` endpoints to your app.
2020
21- Customization
22- -------------
23-
24- This package provides the following Views: \* ``GraphQLView ``: endpoint
25- for expose the GraphQL schema \* ``GraphiQLView ``: Graphical Interface
26- for operate with GraphQL easily
27-
28- You can also add only the views you want to use:
29-
30- .. code :: python
31-
32- from flask_graphql import GraphQLView, GraphiQLView
33-
34- app.add_url_rule(' /graphql' , view_func = GraphQLView.as_view(' graphql' , schema = schema))
35-
3621Supported options
3722~~~~~~~~~~~~~~~~~
3823
3924- ``schema ``: The ``GraphQLSchema `` object that you want the view to
4025 execute when it gets a valid request.
26+ - ``context ``: A value to pass as the ``context `` to the ``graphql() ``
27+ function.
28+ - ``root_value ``: The ``root_value `` you want to provide to
29+ ``executor.execute ``.
4130- ``pretty ``: Whether or not you want the response to be pretty printed
4231 JSON.
4332- ``executor ``: The ``Executor `` that you want to use to execute
4433 queries.
45- - ``root_value ``: The ``root_value `` you want to provide to
46- ``executor.execute ``.
47- - ``default_query ``: The ``default_query `` you want to provide to
48- GraphiQL interface.
34+ - ``graphiql ``: If ``True ``, may present
35+ [GraphiQL][https://github.com/graphql/graphiql] when loaded directly
36+ from a browser (a useful tool for debugging and exploration).
4937
5038You can also subclass ``GraphQLView `` and overwrite
5139``get_root_value(self, request) `` to have a dynamic root value per
@@ -57,8 +45,8 @@ request.
5745 def get_root_value (self , request ):
5846 return request.user
5947
60- .. |Build Status | image :: https://travis-ci.org/graphql-python/graphql- flask.svg?branch=master
61- :target: https://travis-ci.org/graphql-python/graphql- flask
48+ .. |Build Status | image :: https://travis-ci.org/graphql-python/flask-graphql .svg?branch=master
49+ :target: https://travis-ci.org/graphql-python/flask-graphql
6250.. |Coverage Status | image :: https://coveralls.io/repos/graphql-python/graphql-flask/badge.svg?branch=master&service=github
6351 :target: https://coveralls.io/github/graphql-python/graphql-flask?branch=master
6452.. |PyPI version | image :: https://badge.fury.io/py/graphql-flask.svg
0 commit comments