diff options
| author | nasrlol <nsrddyn@gmail.com> | 2024-11-27 00:54:43 +0100 |
|---|---|---|
| committer | nasrlol <nsrddyn@gmail.com> | 2024-11-27 00:54:43 +0100 |
| commit | df6d2c51b15d55a30b8515de637aa7af490b2d95 (patch) | |
| tree | 25afa36b2be61783997eb59633e9c7e4aff438b7 /public/api.py | |
| parent | 4e86a2ee9f5578cbaae6cc7dd52616e3e3751764 (diff) | |
small modifications to the file system
Diffstat (limited to 'public/api.py')
| -rw-r--r-- | public/api.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/public/api.py b/public/api.py new file mode 100644 index 0000000..b04ef77 --- /dev/null +++ b/public/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) |
