예제 #1
0
def handle_brands():
    if request.method == 'GET':
        return jsonify(Brand.getAllSerialized()), 200
    if request.method == 'POST':
        body = request.get_json()
        newBrand = Brand.newInstance(body)
        newBrand.addCommit()
        return toJson(newBrand), 201