Skip to content

Instantly share code, notes, and snippets.

@ashish-mj
Created May 4, 2024 16:27
Show Gist options
  • Save ashish-mj/a693e992c766bcd78682e1d4bae6beee to your computer and use it in GitHub Desktop.
Save ashish-mj/a693e992c766bcd78682e1d4bae6beee to your computer and use it in GitHub Desktop.
from flask_graphql import GraphQLView
from graphene import Schema,ObjectType,String, Argument
from flask import Flask
app = Flask(__name__)
class Query(ObjectType):
hello = String(name = Argument(String, default_value = "World"))
def resolve_hello(self, info, name):
return 'Hello ' + name
schema = Schema(query=Query)
app.add_url_rule('/staffday',view_func=GraphQLView.as_view( 'staffday',schema=schema, graphiql=True))
if __name__ == '__main__':
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment