大家好,我已经在IBM Cloud上部署了一个函数,我通过Web api对其进行了调用,但是除了涉及路由参数的那些函数(我无法提取它们)之外,所有函数都可以正常工作。我正在使用无服务器框架,并且在调用变量__ow_path
时返回空。任何帮助将不胜感激。谢谢。
serverless.yml
文件:
getById:
handler: handler.getById
overwrite: true
annotations:
web-export: true
events:
- http:
method: GET
path: /users/{userid}
resp: http
handler.js
文件:
module.exports.getById = async (params) => {
return {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
params,
msg: params.__ow_path,
created: new Date()
}),
statusCode: 200
}
}