-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathapp.py
49 lines (45 loc) · 813 Bytes
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from database import init_db
from flask import Flask
from flask_graphql import GraphQLView
from schema import schema
app = Flask(__name__)
app.debug = True
default_query = """
{
allEmployees {
edges {
node {
id,
name,
department {
id,
name
},
roles {
edges {
node {
id,
name
}
}
},
leader {
id,
name
}
tasks {
edges {
node {
name,
deadline
}
}
}
}
}
}
}""".strip()
app.add_url_rule("/graphql", view_func=GraphQLView.as_view("graphql", schema=schema, graphiql=True))
if __name__ == "__main__":
init_db()
app.run()