Skip to content

Commit 7175af5

Browse files
committed
updated README, license
1 parent a53c206 commit 7175af5

File tree

2 files changed

+40
-14
lines changed

2 files changed

+40
-14
lines changed

LICENSE.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
2222

2323
Copyright for portions of project aiohttp-graphql are held by Syrus Akbary, 2015
24-
as part of project flask-graphql. All other copyright for project aiohttp-graphql
25-
are held by Devin Fee.
24+
as part of project flask-graphql, and Sergey Privaev, as part of project
25+
sanic-graphql. All other copyright for project aiohttp-graphql are held by Devin
26+
Fee.

README.md

+37-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
aiohttp-graphql
2-
===============
3-
1+
# aiohttp-graphql
42
Adds [GraphQL] support to your [aiohttp] application.
53

6-
Based on [flask-graphql] by [Syrus Akbary].
7-
8-
Usage
9-
-----
4+
Based on [flask-graphql] by [Syrus Akbary] and [sanic-graphql] by [Sergey Porivaev].
105

6+
## Usage
117
Just use the `GraphQLView` view from `aiohttp_graphql`
128

139
```python
@@ -19,7 +15,21 @@ GraphQLView.attach(app, schema=Schema, graphiql=True)
1915
GraphQLView.attach(app, schema=Schema, batch=True)
2016
```
2117

22-
This will add a `/graphql` endpoint to your app (customizable by passing `route_path='/mypath'` to `GraphQLView.attach`)
18+
This will add a `/graphql` endpoint to your app (customizable by passing `route_path='/mypath'` to `GraphQLView.attach`).
19+
20+
Note: `GraphQLView.attach` is just a convenience function, and the same functionality can be acheived with
21+
22+
```python
23+
gql_view = GraphQLView(schema=Schema, **kwargs)
24+
app.router.add_route('*', gql_view, name='graphql')
25+
```
26+
27+
It's worth noting that the the "view function" of `GraphQLView` is contained in `GraphQLView.__call__`. So, when you create an instance, that instance is callable with the request object as the sole positional argument. To illustrate:
28+
29+
```python
30+
gql_view = GraphQLView(schema=Schema, **kwargs)
31+
gql_view(request) # <-- the instance is callable and expects a `aiohttp.web.Request` object.
32+
```
2333

2434
### Supported options
2535
- `schema`: The `GraphQLSchema` object that you want the view to execute when it gets a valid request.
@@ -40,17 +50,32 @@ This will add a `/graphql` endpoint to your app (customizable by passing `route_
4050
- `enable_async`: whether `async` mode will be enabled.
4151

4252

43-
License
44-
-------
53+
## Testing
54+
Testing is done with `pytest`.
55+
56+
```bash
57+
git clone https://github.com/dfee/aiohttp-graphql
58+
cd aiohttp-graphql
59+
# Create a virtualenv
60+
python3.6 -m venv env && source env/bin/activate # for example
61+
pip install -e .[test]
62+
pytest
63+
```
64+
65+
The tests, while modeled after sanic-graphql's tests, have been entirely refactored to take advantage of `pytest-asyncio`, conform with PEP-8, and increase readability with pytest fixtures. For usage tests, please check them out.
66+
4567

46-
Copyright for portions of project [aiohttp-graphql] are held by [Syrus Akbary] as part of project [flask-graphql]. All other claims to this project [aiohttp-graphql] are held by [Devin Fee].
68+
## License
69+
Copyright for portions of project [aiohttp-graphql] are held by [Syrus Akbary] as part of project [flask-graphql] and [sanic-graphql] as part of project [Sergey Porivaev]. All other claims to this project [aiohttp-graphql] are held by [Devin Fee].
4770

48-
This project is licensed under MIT License.
71+
This project is licensed under the MIT License.
4972

5073
[GraphQL]: http://graphql.org/
5174
[aiohttp]: https://github.com/aio-libs/aiohttp/
5275
[flask-graphql]: https://github.com/graphql-python/flask-graphql
76+
[sanic-graphql]: https://github.com/graphql-python/sanic-graphql
5377
[Syrus Akbary]: https://github.com/syrusakbary
78+
[Sergey Porivaev]: https://github.com/grazor
5479
[GraphiQL]: https://github.com/graphql/graphiql
5580
[graphql-python]: https://github.com/graphql-python/graphql-core
5681
[Apollo-Client]: http://dev.apollodata.com/core/network.html#query-batching

0 commit comments

Comments
 (0)