From f4aec7beaf3aa30a3357fc682a0def2f61e412fd Mon Sep 17 00:00:00 2001 From: rolandpo Date: Wed, 16 Nov 2022 15:25:33 +0100 Subject: [PATCH 1/2] add contributors api route --- views/web_views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/views/web_views.py b/views/web_views.py index 207ba3df0..9b68d7ec7 100644 --- a/views/web_views.py +++ b/views/web_views.py @@ -161,6 +161,12 @@ def team(): return render_template("team.html", contributors=contributors) +@app.route("/contributors", strict_slashes=False) +@app.route("//contributors", strict_slashes=False) +def contributors(): + contributors = db_models.Contributor.query.all() + return jsonify({"contributors": contributors}) + @app.route("/admin", strict_slashes=False) @app.route("//admin", strict_slashes=False) def admin(): From 2edd62d5a5a92e97d77049fe3e4d8bcef7b534e5 Mon Sep 17 00:00:00 2001 From: rolandpo Date: Wed, 7 Dec 2022 18:10:20 +0100 Subject: [PATCH 2/2] add get method to endpoint --- views/web_views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/web_views.py b/views/web_views.py index 9b68d7ec7..47dd711a2 100644 --- a/views/web_views.py +++ b/views/web_views.py @@ -161,8 +161,8 @@ def team(): return render_template("team.html", contributors=contributors) -@app.route("/contributors", strict_slashes=False) -@app.route("//contributors", strict_slashes=False) +@app.route("/contributors", methods=["GET"], strict_slashes=False) +@app.route("//contributors", methods=["GET"], strict_slashes=False) def contributors(): contributors = db_models.Contributor.query.all() return jsonify({"contributors": contributors})