changed db connection

This commit is contained in:
ishak jmilou.ishak
2025-01-14 12:08:08 +01:00
parent 5844387b19
commit 3232ff121f

View File

@@ -108,15 +108,6 @@ def move():
db_connection.close()
return jsonify({"status": "success", "direction": direction})
@app.route("/database")
def database():
db = get_db()
cursor = db.cursor()
cursor.execute("SELECT * FROM kobuki_data")
rows = cursor.fetchall()
cursor.close()
return str(rows)
@app.route('/data', methods=['GET'])
def data():
@@ -139,7 +130,7 @@ def data():
# Database-insert
db = get_db()
cursor = db.cursor()
with db.cursor() as cursor:
# Zorg dat je tabel `kobuki_data` kolommen heeft: `name` en `value`
sql_sensor = "INSERT INTO kobuki_data (name, value) VALUES (%s, %s)"