aboutsummaryrefslogtreecommitdiff
path: root/gn3/api
diff options
context:
space:
mode:
Diffstat (limited to 'gn3/api')
-rw-r--r--gn3/api/menu.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/gn3/api/menu.py b/gn3/api/menu.py
new file mode 100644
index 0000000..cc77ab8
--- /dev/null
+++ b/gn3/api/menu.py
@@ -0,0 +1,14 @@
+"""API for data used to generate menus"""
+
+from flask import jsonify, Blueprint
+
+from gn3.db.menu import gen_dropdown_json
+from gn3.db_utils import database_connector
+
+menu = Blueprint("menu", __name__)
+
+@menu.route("/generate/json")
+def generate_json():
+ """Get the menu in the JSON format"""
+ with database_connector() as conn:
+ return jsonify(gen_dropdown_json(conn))