def put(self, person_id): person = Person.query.filter_by(id=person_id).first() data = request.get_json() person.name = data["name"] person.email = data["email"] person.age = data["age"] db.session.commit() return make_json(person), 201
def put(self, person_id): person = Person.query.filter_by(id=person_id).first() data = request.get_json() person.name = data['name'] person.email = data['email'] person.age = data['age'] db.session.commit() return make_json(person), 201
def post(self): data = request.get_json() name = data["name"] email = data["email"] age = data["age"] person = Person(name, email, age) db.session.add(person) db.session.commit() return make_json(person)
def get(self, person_id): person = Person.query.filter_by(id=person_id).first() return make_json(person)
def get(self): return make_json(Person.query.all())