Skip to content

Commit 451ff14

Browse files
added query to get all entries in database
1 parent 0232a98 commit 451ff14

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/app/routes.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
from flask.json import jsonify
55
from flask import request
66
from app.FileDelegate import FileDelegate
7+
from app.recipe import Recipe
78

89

910
@app.route('/', methods=['GET'])
1011
@app.route('/status')
1112
def index():
12-
response = {'status': "OK", 'Time': datetime.datetime.now(), 'project': 'recipes'}
13+
response = {'status': "OK", 'Time': datetime.datetime.now(),
14+
'project': 'recipes'}
1315
return jsonify(response)
1416

1517

@@ -25,7 +27,10 @@ def searchByTagsAll():
2527

2628
@app.route("/search/all", methods=['GET'])
2729
def getAll():
28-
return jsonify("{}")
30+
recipes = Recipe.query.all()
31+
toJson = list(map((lambda r: r.toJson()), recipes))
32+
return jsonify(toJson)
33+
2934

3035

3136
@app.route("/search/ByIngredients", methods=['GET'])

0 commit comments

Comments
 (0)