from flask import Flask, jsonify from config import DevelopmentConfig from lib.mysql import execute_query app = Flask(__name__) app.config.from_object(DevelopmentConfig) @app.route('/getUserAccounts', methods=['GET']) def get_user_accounts(): # Use the execute_query function to get user accounts data = execute_query("SELECT COUNT(*) AS account_count FROM userAccounts WHERE userID = %s;", (1,)) if data is None: return jsonify({"error": "Database query failed"}), 500 return jsonify(data), 200 # Run the app if __name__ == '__main__': app.run(debug=app.config["DEBUG"], port=app.config["PORT"])