Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -97,27 +97,6 @@ def menu_page():
|
|
97 |
except Exception as e:
|
98 |
return jsonify({"error": f"Failed to fetch menu: {str(e)}"}), 500
|
99 |
|
100 |
-
# ✅ MENU API (Returns menu items in JSON format)
|
101 |
-
@app.route("/menu", methods=["GET"])
|
102 |
-
def get_menu():
|
103 |
-
try:
|
104 |
-
query = "SELECT Name, Price__c, Ingredients__c, Category__c, Image_URL__c FROM Menu_Item__c"
|
105 |
-
result = sf.query(query)
|
106 |
-
|
107 |
-
menu_items = []
|
108 |
-
for item in result["records"]:
|
109 |
-
menu_items.append({
|
110 |
-
"name": item["Name"],
|
111 |
-
"price": item["Price__c"],
|
112 |
-
"ingredients": item["Ingredients__c"],
|
113 |
-
"category": item["Category__c"],
|
114 |
-
"image_url": item.get("Image_URL__c", "default_image.jpg") # Fallback if no image is found
|
115 |
-
})
|
116 |
-
|
117 |
-
return static/images/your_image.jpg("Image_URL__c", menu=menu_items)
|
118 |
-
except Exception as e:
|
119 |
-
return jsonify({"error": f"Failed to fetch menu: {str(e)}"}), 500
|
120 |
-
|
121 |
|
122 |
# ✅ STATIC IMAGES ROUTE
|
123 |
@app.route("/static/images/<path:filename>")
|
|
|
97 |
except Exception as e:
|
98 |
return jsonify({"error": f"Failed to fetch menu: {str(e)}"}), 500
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
# ✅ STATIC IMAGES ROUTE
|
102 |
@app.route("/static/images/<path:filename>")
|