diff --git a/backend/api.py b/backend/api.py index 248102c..7e61c54 100644 --- a/backend/api.py +++ b/backend/api.py @@ -1,6 +1,5 @@ from fastapi import FastAPI, Request from fastapi.responses import HTMLResponse - from modal import Image, Stub, asgi_app web_app = FastAPI() diff --git a/backend/graphql/query.py b/backend/graphql/query.py new file mode 100644 index 0000000..b541793 --- /dev/null +++ b/backend/graphql/query.py @@ -0,0 +1,19 @@ +import strawberry +from typing import List + +@strawberry.type +class Book: + title: str + author: str + +def get_books(): + return [ + Book( + title="The Great Gatsby", + author="F. Scott Fitzgerald", + ), + ] + +@strawberry.type +class Query: + books: List[Book] = strawberry.field(resolver=get_books) diff --git a/backend/graphql/schema.py b/backend/graphql/schema.py new file mode 100644 index 0000000..3b7e3a7 --- /dev/null +++ b/backend/graphql/schema.py @@ -0,0 +1,7 @@ +import strawberry + +from .query import Query + +schema = strawberry.Schema( + query=Query +) diff --git a/frontend/src/graphql/__generated__/schema.graphql b/frontend/src/graphql/__generated__/schema.graphql new file mode 100644 index 0000000..b838fc3 --- /dev/null +++ b/frontend/src/graphql/__generated__/schema.graphql @@ -0,0 +1,8 @@ +type Book { + title: String! + author: String! +} + +type Query { + books: [Book!]! +}