From 1703916e19070b2b96a9e7c9aec5ce4a592a6c77 Mon Sep 17 00:00:00 2001 From: ctmbl Date: Wed, 26 Apr 2023 22:16:34 +0200 Subject: [PATCH 1/4] Update backend/.gitignore --- backend/.gitignore | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/.gitignore b/backend/.gitignore index 935306f..8a128e4 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1,3 +1,2 @@ -build -node_modules -.env \ No newline at end of file +__pycache__/** + From 7341bb2f837c79a04ee9e209e02d3970bd300f86 Mon Sep 17 00:00:00 2001 From: ctmbl Date: Wed, 26 Apr 2023 22:17:46 +0200 Subject: [PATCH 2/4] Add basic app.py --- backend/app.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 backend/app.py diff --git a/backend/app.py b/backend/app.py new file mode 100644 index 0000000..b08c9a7 --- /dev/null +++ b/backend/app.py @@ -0,0 +1,19 @@ +from flask import Flask, jsonify + +app = Flask(__name__) + +dummy_article = { + 'author':'ctmbl', + } + +@app.route('/') +def root(): + return 'iscsc.fr backend is running' + +@app.route('/api/articles', methods=['GET']) +def fetch_all_articles(): + + +@app.route('/api/article/', methods=['GET']) +def fetch_article(id): + return \ No newline at end of file From da8f236e602b1112d1741dca664b4e55f705ac10 Mon Sep 17 00:00:00 2001 From: ctmbl Date: Thu, 27 Apr 2023 00:22:29 +0200 Subject: [PATCH 3/4] Add /articles and /article/ routes --- backend/app.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/app.py b/backend/app.py index b08c9a7..a6af0b8 100644 --- a/backend/app.py +++ b/backend/app.py @@ -4,6 +4,8 @@ dummy_article = { 'author':'ctmbl', + 'title':'My dummy article', + 'body':'This is a dummy article hardcoded to build the backend' } @app.route('/') @@ -12,8 +14,8 @@ def root(): @app.route('/api/articles', methods=['GET']) def fetch_all_articles(): - + return jsonify([dummy_article, dummy_article]) @app.route('/api/article/', methods=['GET']) def fetch_article(id): - return \ No newline at end of file + return jsonify(dummy_article) \ No newline at end of file From 592bbe5f20b549417b545f955675b921ec5166a8 Mon Sep 17 00:00:00 2001 From: ctmbl Date: Wed, 17 May 2023 10:34:02 +0200 Subject: [PATCH 4/4] Fixes: working basic routes articles and articles/ --- backend/app.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/app.py b/backend/app.py index a6af0b8..bba16b1 100644 --- a/backend/app.py +++ b/backend/app.py @@ -5,7 +5,15 @@ dummy_article = { 'author':'ctmbl', 'title':'My dummy article', - 'body':'This is a dummy article hardcoded to build the backend' + 'body':'This is a dummy article hardcoded to build the backend', + '_id':"1" + } + +dummy_article_2 = { + 'author':'ctmbl', + 'title':'My dummy article 2', + 'body':'This is a dummy article 2', + '_id':"2" } @app.route('/') @@ -14,8 +22,8 @@ def root(): @app.route('/api/articles', methods=['GET']) def fetch_all_articles(): - return jsonify([dummy_article, dummy_article]) + return jsonify([dummy_article, dummy_article_2]) -@app.route('/api/article/', methods=['GET']) +@app.route('/api/articles/', methods=['GET']) def fetch_article(id): return jsonify(dummy_article) \ No newline at end of file