-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_ifaces_app.py
30 lines (25 loc) · 1.03 KB
/
example_ifaces_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from flask import Flask
from flask_graphql import GraphQLView
from mongoengine import connect
from graphene_mongo_extras.interfaces.tests.schema import schema
from graphene_mongo_extras.interfaces.tests.models import Packaging, \
Plushie, Videogame
connect(host='mongomock://localhost', db='graphene-mongo-extras')
fifipak = Packaging(name="FifiPak").save()
Plushie(name="fifi", animal="dog",
packaging=fifipak).save()
kittypak = Packaging(name="KittyPak").save()
Plushie(name="kitty", animal="cat",
packaging=kittypak).save()
contrapak = Packaging(name="ContraPak").save()
Videogame(name="Contra", genre="shmup",
packaging=contrapak).save()
dspak = Packaging(name="DSPak").save()
Videogame(name="Dark Souls", genre="masochism",
packaging=dspak).save()
app = Flask(__name__)
app.add_url_rule(
'/graphql',
view_func=GraphQLView.as_view('graphql',
schema=schema,
graphiql=True))