From 5f8fb4178732d814f23d04bdcbf39ba9636dcb2c Mon Sep 17 00:00:00 2001 From: Jeffrey Epstein Date: Thu, 19 Feb 2026 13:29:03 +0100 Subject: [PATCH] Aggiunta funzione templates --- app.py | 12 ++++++++++++ templates/doc.html | 1 + 2 files changed, 13 insertions(+) diff --git a/app.py b/app.py index 0633d3c..201ffc7 100644 --- a/app.py +++ b/app.py @@ -15,6 +15,18 @@ def home(): html += "Documentazione" return html, 200 +@app.route("/", methods=["GET"]) +def template(filename): + if not filename.endswith(".html"): + return "File non valido", 404 + try: + read_file = open(f"templates/{filename}", "r") + content = read_file.read() + read_file.close() + return content, 200 + except FileNotFoundError: + return "File non trovato", 404 + @app.route("/compiti", methods=["GET"]) def get_compiti(): return jsonify(compiti), 200 diff --git a/templates/doc.html b/templates/doc.html index e69de29..acaa0e9 100644 --- a/templates/doc.html +++ b/templates/doc.html @@ -0,0 +1 @@ +haiiiii :3 \ No newline at end of file