diff --git a/.gitignore b/.gitignore index df33619..b5e3c01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ creds.sh - +veggify*.json # Created by https://www.gitignore.io/api/venv,python,pycharm diff --git a/server/app.py b/server/app.py index 152e106..8923724 100644 --- a/server/app.py +++ b/server/app.py @@ -29,20 +29,20 @@ configure_uploads(app, photos) -@app.route('/', methods=['GET']) +@app.route('/api/v1/', methods=['GET']) @cross_origin() def play_command(): return jsonify(status=200, db=app.config['SQLALCHEMY_DATABASE_URI']), 200 -@app.route('/photo/', methods=['GET']) +@app.route('/api/v1/photo/', methods=['GET']) def get_labels(hash_value): if request.method == 'GET' and hash_value: labels = MealMatcher.load_labels(hash_value) return jsonify(results=labels) -@app.route('/upload', methods=['POST']) +@app.route('/api/v1/upload', methods=['POST']) def upload_picture(): if request.method == 'POST' and 'photo' in request.files: content = request.files['photo'].read() @@ -64,7 +64,7 @@ def upload_picture(): return jsonify(status=204) -@app.route('/meal/add', methods=['POST']) +@app.route('/api/v1/meal/add', methods=['POST']) def meal_add(): if request.method == 'POST' and 'recipe' in request.form: recipe = request.form['recipe'] @@ -76,14 +76,14 @@ def meal_add(): return jsonify(status=500), 500 -@app.route('/meal', methods=['GET']) +@app.route('/api/v1/meal', methods=['GET']) def get_all_meals(): if request.method == 'GET': return jsonify(meals=Meal.query.all()), 200 return jsonify(status=500), 500 -@app.route('/meal/', methods=['GET']) +@app.route('/api/v1/meal/', methods=['GET']) def get_meal(meal_id): if request.method == 'GET' and int(meal_id) > 0: return jsonify(meal=Meal.query.filter_by(id=meal_id).first()), 200