Skip to content

Commit

Permalink
Add (beautiful) prefix for routes, more creds to gitignore.
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-bode committed May 26, 2018
1 parent 692ff02 commit b5794ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
creds.sh

veggify*.json

# Created by https://www.gitignore.io/api/venv,python,pycharm

Expand Down
12 changes: 6 additions & 6 deletions server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<hash_value>', methods=['GET'])
@app.route('/api/v1/photo/<hash_value>', 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()
Expand All @@ -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']
Expand All @@ -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/<meal_id>', methods=['GET'])
@app.route('/api/v1/meal/<meal_id>', 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
Expand Down

0 comments on commit b5794ef

Please sign in to comment.