【发布时间】:2018-09-17 19:42:46
【问题描述】:
我使用无服务器框架来部署我的 lambda 函数。 Serverless 使用 API Gateway 来创建我的端点。我知道可以在 GET 等方法中传递参数,并通过使用事件对象在 lambda 中使用它。前端已经部署,他们正在使用以下 URL 调用端点:
example.com/api/EG43
`exports.myHandler = async function(event, context) {
...
// somehow access the URL which was used by the frontend
// to grab that EG43 and then return the result based on that key.
// return information to the caller.
}
哪个 EG43 是前一个后端基于该键返回结果的键。我的问题是,是否有可能以某种方式知道 URL 是什么。 AWS 的以下文档显示了可以使用处理程序参数读取的参数,但它没有 URL。
https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
【问题讨论】:
-
请提供您的编码尝试。
-
@wayneOS 已编辑。
标签: node.js amazon-web-services aws-lambda handler