Skip to content

Commit d5d1b33

Browse files
authored
Merge pull request graphql#962 from patrick91/add-strawberry
Add strawberry as a Python library
2 parents 93c7381 + c7883c9 commit d5d1b33

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Strawberry
3+
description: Strawberry is a Python library for implementing code first GraphQL servers using modern Python features like type hints.
4+
url: https://strawberry.rocks
5+
github: strawberry-graphql/strawberry
6+
---
7+
8+
Here's an example of a Strawberry hello world, first install the library:
9+
10+
```bash
11+
pip install strawberry-graphql
12+
```
13+
14+
Create an `app.py` file with this content:
15+
16+
```python
17+
import strawberry
18+
19+
@strawberry.type
20+
class Query:
21+
@strawberry.field
22+
def hello(self, name: str = "World") -> str:
23+
return f"Hello {name}"
24+
25+
schema = strawberry.Schema(query=Query)
26+
```
27+
28+
Then run `strawberry server app` and you will have a basic schema server
29+
running on `http://localhost:8000/`.
30+
31+
Strawberry also has views for ASGI, Flask and Django and provides utilities
32+
like dataloaders and tracing.

0 commit comments

Comments
 (0)