chalice icon indicating copy to clipboard operation
chalice copied to clipboard

Is it possible to update API gateway routes ?

Open mangled-data opened this issue 2 years ago • 1 comments
trafficstars

I would like to use chalice to setup API gateway. I start with a simple route

def index():
    return {'hello': 'world'}

@app.route('/customer1')
def index():
    return {'who': 'customer1'}

@app.route('/customer2')
def index():
    return {'who': 'customer2'}

Now customer3 arrives few days later. Is there a way to update without shutting down and restarting all the resources. Thanks for pointers as it'd help me decide if chalice is the right way to go. I just tried custom domain and chalice was such a breeze!! Fantastic productive framework!

mangled-data avatar May 07 '23 18:05 mangled-data

The normal way to achieve this is by separating the type of resource from the identifier. So /customer/{id} for example.

Chalice lets you do something like this.

@app.route('/customer/{id}', methods=['GET'])
def get_customer(id):
    return {'who': f'customer{id}'}

sean-hernon avatar May 26 '23 10:05 sean-hernon