change api endpoint

This commit is contained in:
√(noham)² committed 2024-03-01 17:27:38 +01:00
1 parent 3c9f01aa7d
commit 55253bec44
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -1,6 +1,8 @@
from flask import Flask, request, jsonify
from flask_cors import CORS
app = Flask(__name__)
CORS(app, resources={r"/music/*": {"origins": "http://127.0.0.1:5500"}})
@app.route('/music/set', methods=['POST'])
def set_content():
@@ -8,7 +10,7 @@ def set_content():
cache = request.get_json()
return jsonify({'message': 'Content set successfully'})
@app.route('/music/display', methods=['GET'])
@app.route('/music/get', methods=['GET'])
def display_content():
return jsonify(cache)
+1 -1
View File
@@ -13,5 +13,5 @@ json_payload = json.dumps(payload)
headers = {'Content-Type': 'application/json'}
r = requests.post(url+'/set', data=json_payload, headers=headers)
r = requests.get(url+'/display')
r = requests.get(url+'/get')
print(r.text)