feat: Add some readme info and add some more boilerplate code
All checks were successful
Build Docker / BuildImage (push) Successful in 2m37s

This commit is contained in:
2025-07-02 15:55:50 +10:00
parent a6adc553d9
commit 6d6a443c89
4 changed files with 108 additions and 3 deletions

View File

@@ -74,7 +74,9 @@ def wellknown(path):
# region Main routes
@app.route("/")
def index():
return render_template("index.html")
# Get current time in the format "dd MMM YYYY hh:mm AM/PM"
current_datetime = datetime.now().strftime("%d %b %Y %I:%M %p")
return render_template("index.html", datetime=current_datetime)
@app.route("/<path:path>")
@@ -102,6 +104,31 @@ def catch_all(path: str):
# endregion
# region API routes
api_requests = 0
@app.route("/api/v1/data", methods=["GET"])
def api_data():
"""
Example API endpoint that returns some data.
You can modify this to return whatever data you need.
"""
global api_requests
api_requests += 1
data = {
"header": "Sample API Response",
"content": f"Hello, this is a sample API response! You have called this endpoint {api_requests} times.",
"timestamp": datetime.now().isoformat(),
}
return jsonify(data)
# endregion
# region Error Catching
# 404 catch all
@app.errorhandler(404)