Hello everyone I have deployed a function on IBM cloud and I am calling it via web api however all the function works fine except for those that involve route parameters as I am unable to extract them. I am using the serverless framework and when calling the variable __ow_path
it returns empty. Any help will be highly appreciated. Thanks.
serverless.yml
file:
getById:
handler: handler.getById
overwrite: true
annotations:
web-export: true
events:
- http:
method: GET
path: /users/{userid}
resp: http
handler.js
file:
module.exports.getById = async (params) => {
return {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
params,
msg: params.__ow_path,
created: new Date()
}),
statusCode: 200
}
}