-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.py
65 lines (56 loc) · 1.52 KB
/
server.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from flask import Flask
from flask import jsonify
from flask import render_template
from flask import request
from flask import abort
import arora_gouda
app = Flask(__name__)
@app.route('/arora-gouda/add-node', methods = ['POST'])
def add_node():
result = arora_gouda.add_node(request.json)
if result:
return jsonify(result)
else:
return jsonify({})
@app.route('/arora-gouda/remove-node', methods = ['POST'])
def remove_node():
result = arora_gouda.remove_node(request.json)
if result:
return jsonify(result)
else:
return jsonify({})
@app.route('/arora-gouda/add-edge', methods = ['POST'])
def add_edge():
result = arora_gouda.add_edge(request.json)
if result:
return jsonify(result)
else:
return jsonify({})
@app.route('/arora-gouda/remove-edge', methods = ['POST'])
def remove_edge():
result = arora_gouda.remove_edge(request.json)
if result:
return jsonify(result)
else:
return jsonify({})
@app.route('/arora-gouda/clear', methods = ['POST'])
def clear():
result = arora_gouda.clear()
if result:
return jsonify(result)
else:
return jsonify({})
@app.route('/arora-gouda/run', methods = ['POST', 'GET'])
def run():
result = arora_gouda.run()
if result:
return jsonify(result)
else:
return jsonify({})
@app.route('/')
def home():
arora_gouda.clear()
return render_template('index.html')
if __name__ == '__main__':
print 'Started server'
app.run(debug = True)