aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/menu.py
blob: 377ac6b224266dcc8fb575671c8b513d5739dbc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""API for data used to generate menus"""

from flask import jsonify, Blueprint, current_app

from gn3.db.menu import gen_dropdown_json
from gn3.db_utils import database_connection

menu = Blueprint("menu", __name__)

@menu.route("/generate/json")
def generate_json():
    """Get the menu in the JSON format"""
    with database_connection(current_app.config["SQL_URI"], logger=current_app.logger) as conn:
        return jsonify(gen_dropdown_json(conn))