Antoni09 commited on
Commit
40e19ad
·
verified ·
1 Parent(s): b2cf4b1

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +8 -7
server.py CHANGED
@@ -41,13 +41,14 @@ ALLOWED_STATIC = {
41
  "Roboto-VariableFont_wdth,wght.ttf",
42
  }
43
 
44
- @app.get("/")
45
- def health():
46
- return {"ok": True}
47
- if __name__ == "__main__":
48
- import os
49
- port = int(os.environ.get("PORT", "7860"))
50
- app.run(host="0.0.0.0", port=port, debug=False)
 
51
 
52
  @app.get("/")
53
  def index():
 
41
  "Roboto-VariableFont_wdth,wght.ttf",
42
  }
43
 
44
+ @app.route("/")
45
+ def index():
46
+ # Pobierz ostatnie notatki i pokaż w HTML
47
+ with engine.begin() as conn:
48
+ rows = conn.execute(text(
49
+ "SELECT id, body, created_at FROM notes ORDER BY id DESC LIMIT 20"
50
+ )).mappings().all()
51
+ return render_template("index.html", notes=rows)
52
 
53
  @app.get("/")
54
  def index():