diff options
| author | Abdellah El Morabit <nsrddyn@gmail.com> | 2024-11-24 12:41:38 +0100 |
|---|---|---|
| committer | Abdellah El Morabit <nsrddyn@gmail.com> | 2024-11-24 12:41:38 +0100 |
| commit | 3a6928a0189bfe8d481c7eeac7a3d3df5dd9cdc0 (patch) | |
| tree | 86a00bcd10dae82ac566e68c2c525fa71a44607a /templates/api.py | |
| parent | 567787eabe414592d005c727868091bcba2bf6fe (diff) | |
updates to the web gui
Diffstat (limited to 'templates/api.py')
| -rw-r--r-- | templates/api.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/templates/api.py b/templates/api.py new file mode 100644 index 0000000..b04ef77 --- /dev/null +++ b/templates/api.py @@ -0,0 +1,27 @@ +from flask import Flask, request, jsonify, render_template + +app = Flask(__name__) + + +@app.route("/") +def index(): + return render_template("index.html") + + +@app.route("/api/run-script", methods=["POST"]) +def run_script(): + data = request.json + if not data: + return jsonify({"error": "No data provided"}), 400 + + script_result = my_script_logic(data.get("input")) + + return jsonify({"result": script_result}) + + +def my_script_logic(input_value): + return f"Processed input: {input_value}" + + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=5000, debug=True) |
