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__/** + diff --git a/backend/app.py b/backend/app.py new file mode 100644 index 0000000..bba16b1 --- /dev/null +++ b/backend/app.py @@ -0,0 +1,29 @@ +from flask import Flask, jsonify + +app = Flask(__name__) + +dummy_article = { + 'author':'ctmbl', + 'title':'My dummy article', + '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('/') +def root(): + return 'iscsc.fr backend is running' + +@app.route('/api/articles', methods=['GET']) +def fetch_all_articles(): + return jsonify([dummy_article, dummy_article_2]) + +@app.route('/api/articles/', methods=['GET']) +def fetch_article(id): + return jsonify(dummy_article) \ No newline at end of file