def create_ingredient(jwt): try: data = request.get_json() ingredient = Ingredient(**data) ingredient.insert() return jsonify({'success': True, 'result': ingredient.format()}) except TypeError: abort(400)
def post_ingredient(jwt): res = request.get_json() if not res: abort(404) ingredient = Ingredient(**res) ingredient.insert() result = {"success": True, "result": ingredient.format()} return jsonify(result)