GraphQL
Your code needs to be in a file named
graphql.py
or folder namedgraphql
inside your Application.
File or Folder Layout
Python Code
graphql.py
# -*- coding: utf-8 -*-
"""
API - GraphQL
"""
# Fastberry
import fastberry as fb
# Create your API (GraphQL) here.
@fb.gql
class Demo:
"""Demo Api"""
class Meta:
"""GQL-Class Metadata"""
app = False
model = None
class Query:
"""Query"""
async def detail(info) -> str:
"""Read the Docs"""
print(info)
return "Detail"
class Mutation:
"""Mutation"""
async def create(info) -> str:
"""Read the Docs"""
print(info)
return "Create"
__init__.py
# -*- coding: utf-8 -*-
"""
GraphQL - Init
"""
# Import your <cruds> here.
from .demo import Demo
demo.py
# -*- coding: utf-8 -*-
"""
API - GraphQL
"""
# Fastberry
import fastberry as fb
# Create your API (GraphQL) here.
@fb.gql
class Demo:
"""Demo Api"""
class Meta:
"""GQL-Class Metadata"""
app = False
model = None
class Query:
"""Query"""
async def detail(info) -> str:
"""Read the Docs"""
print(info)
return "Detail"
class Mutation:
"""Mutation"""
async def create(info) -> str:
"""Read the Docs"""
print(info)
return "Create"