File size: 663 Bytes
d458ec9 06a623b 404b810 06a623b 0626a34 06a623b 1e8ceae 06a623b 8efe877 3518be4 f33bdc7 3518be4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from flask import Flask, jsonify, send_from_directory
app = Flask(__name__, static_folder='build', static_url_path='')
@app.route('/api/data')
def get_data():
data = {
"nodes": [
{"id": "1", "data": {"label": "Node 1"}, "position": {"x": 100, "y": 100}},
{"id": "2", "data": {"label": "Node 2"}, "position": {"x": 300, "y": 200}}
],
"edges": [
{"id": "e1-2", "source": "1", "target": "2"}
]
}
return jsonify(data)
@app.route('/')
def serve_index():
return send_from_directory(app.static_folder, 'index.html')
if __name__ == "__main__":
app.run(host="0.0.0.0", port=7860)
|