-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
24 lines (19 loc) · 666 Bytes
/
app.py
File metadata and controls
24 lines (19 loc) · 666 Bytes
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, render_template, request, jsonify
import json
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/configurations', methods=['GET'])
def get_configurations():
with open('configurations.json', 'r') as f:
configurations = json.load(f)
return jsonify(configurations)
@app.route('/configurations', methods=['POST'])
def save_configurations():
configurations = request.get_json()
with open('configurations.json', 'w') as f:
json.dump(configurations, f)
return jsonify({'status': 'success'})
if __name__ == '__main__':
app.run(debug=True, port=8080)