Spaces:
Running
Running
File size: 614 Bytes
0bc0f20 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from flask import Flask, render_template, request, jsonify
import json
app = Flask(__name__)
# Store nodes and connections in memory (replace with database for persistence)
nodes = []
connections = []
@app.route('/')
def index():
return render_template('index.html')
@app.route('/save_nodes', methods=['POST'])
def save_nodes():
global nodes, connections
data = request.get_json()
nodes = data.get('nodes', [])
connections = data.get('connections', [])
return jsonify({'status': 'success', 'nodes': nodes, 'connections': connections})
if __name__ == '__main__':
app.run(debug=True) |