From 56befa23a18148d470c37e031c041a54925bf429 Mon Sep 17 00:00:00 2001 From: jc <419690370@qq.com> Date: Sun, 9 Mar 2025 18:16:49 +0800 Subject: [PATCH] first commit --- app.py | 26 ++++++++++++++++++++++++++ public/index.html | 15 +++++++++++++++ public/script.js | 14 ++++++++++++++ public/style.css | 21 +++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 app.py create mode 100644 public/index.html create mode 100644 public/script.js create mode 100644 public/style.css diff --git a/app.py b/app.py new file mode 100644 index 0000000..d11218f --- /dev/null +++ b/app.py @@ -0,0 +1,26 @@ +from flask import Flask, jsonify + +app = Flask(__name__, static_folder="public", static_url_path="/static") + + +# 根路径返回 index.html +@app.route("/") +def serve_index(): + return app.send_static_file("index.html") + + +# API 子路径,提供数据 +@app.route("/api/daily-workout") +def api_daily_workout(): + return jsonify({ + "message": "Your daily workout plan", + "data": [ + {"description": "Running", "duration": "30 minutes"}, + {"description": "Yoga", "duration": "1 hour"}, + {"description": "Strength training", "duration": "45 minutes"} + ] + }) + + +if __name__ == "__main__": + app.run(debug=True, port=80) \ No newline at end of file diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..7103f2f --- /dev/null +++ b/public/index.html @@ -0,0 +1,15 @@ + + +
+ +