def get(self): posts = BlogPost.get_all() results = [] for post in posts: obj = post.to_json() results.append(obj) return results
def home(): posts = BlogPost.get_all() results = [] for post in posts: obj = { "id": post.id, "title": post.title, "content": post.content, "date_created": post.date_created, "date_modified": post.date_modified } results.append(obj) response = jsonify(results) response.status_code = 200 return response