diff options
author | Frederick Muriuki Muriithi | 2022-05-26 16:42:27 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-05-26 16:42:27 +0300 |
commit | 236d9236c794d7870258eab9e087f990c557462a (patch) | |
tree | 8f5d38f5819ac6853c99215a7fe983263d784b2a /gn3/api | |
parent | fdf9061981ce5d341d178951adeb19dd0376ee66 (diff) | |
download | genenetwork3-236d9236c794d7870258eab9e087f990c557462a.tar.gz |
Add Endpoint to get menu items for use in UI
Diffstat (limited to 'gn3/api')
-rw-r--r-- | gn3/api/menu.py | 14 |
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)) |