diff --git a/src/Python/flask/web/app.py b/src/Python/flask/web/app.py index 7f21317..8fe6d4d 100644 --- a/src/Python/flask/web/app.py +++ b/src/Python/flask/web/app.py @@ -61,9 +61,16 @@ def phpmyadmin_passthrough(path): @app.route("/database") def database(): - cur = mysql.connection.cursor() - # cur.execute("SELECT * FROM kobuki_data") - return "hi",404 + try: + cur = mysql.connection.cursor() + cur.execute("SELECT * FROM kobuki_data") + rows = cur.fetchall() # Haal alle rijen op uit het resultaat + cur.close() + + return str(rows) + except Exception as e: + print(f"Database error: {e}") + return "Er is een fout opgetreden bij het ophalen van de databasegegevens.", 500 if __name__ == '__main__': app.run(debug=True, port=5000)