def get_comment_by_id(id): comment = Comments.query.get(id) if not comment: raise PageNotFoundError() data, _ = read_comment_serializer.dump(comment) return jsonify(data=data)
def get_comments(): comments = Comments.query.all() data, _ = read_comment_serializer.dump(comments, many=True) return jsonify(data=data)