INNER CODE UNIT · Python
mutate
The-Art-of-Hacking/websploit · additional-labs/GraphQL/app.py:94
def mutate(self, info, username, email):
user = User(username=username, email=email, id=str(len(users_db) + 1))
return CreateUser(user=user)
class Mutation(graphene.ObjectType):
create_user = CreateUser.Field()
schema = graphene.Schema(query=Query, mutation=Mutation)
# --- Flask App ---
app = Flask(__name__)
app.debug = True
# Add the GraphQL endpoint
app.add_url_rule(
'/graphql',
view_func=GraphQLView.as_view(
'graphql',