cic-internal-integration/apps/cic-eth/cic_eth/graphql/app.py

32 lines
713 B
Python
Raw Normal View History

2021-11-02 16:50:14 +01:00
import os
import cic_eth.cli
from cic_eth.graphql.config import config
2021-11-01 08:48:05 +01:00
from flask import Flask
from flask_graphql import GraphQLView
2021-11-02 16:50:14 +01:00
from cic_eth.graphql.schema import schema
2021-11-01 08:48:05 +01:00
2021-11-02 16:50:14 +01:00
app = cic_eth.cli.CeleryApp.from_config(config)
app.set_default()
print(app)
2021-11-01 08:48:05 +01:00
def create_app():
2021-11-02 16:50:14 +01:00
flask_app = Flask(__name__)
flask_app.add_url_rule(
2021-11-01 08:48:05 +01:00
'/graphql',
view_func=GraphQLView.as_view(
'graphql',
schema=schema,
graphiql=True
)
)
2021-11-02 16:50:14 +01:00
@flask_app.route("/")
2021-11-01 08:48:05 +01:00
def test():
return "Test ok!"
2021-11-02 16:50:14 +01:00
return flask_app
2021-11-01 08:48:05 +01:00
if __name__ == "__main__":
2021-11-02 16:50:14 +01:00
flask_app = create_app()
flask_app.run(host='0.0.0.0', port=5000, debug=True)