【发布时间】:2018-06-15 06:05:22
【问题描述】:
'将处理所有端点的代码放入一个大的 Lambda 函数中,并传入参数告诉 Lambda 函数它需要执行哪个进程'
【问题讨论】:
-
你的问题是什么?
标签: python-3.x aws-lambda aws-api-gateway
'将处理所有端点的代码放入一个大的 Lambda 函数中,并传入参数告诉 Lambda 函数它需要执行哪个进程'
【问题讨论】:
标签: python-3.x aws-lambda aws-api-gateway
您应该详细说明您尝试过的方法以及遇到的主要问题;仍然像您的问题一样模糊,也许您正在寻找类似 @987654321@ 的东西
这是 Chalice 的 README 中示例的一部分,其中相同的 lambda 对不同的路由具有不同的功能
from chalice import Chalice
app = Chalice(app_name='helloworld')
CITIES_TO_STATE = {
'seattle': 'WA',
'portland': 'OR',
}
@app.route('/')
def index():
return {'hello': 'world'}
@app.route('/cities/{city}')
def state_of_city(city):
return {'state': CITIES_TO_STATE[city]}
【讨论】: