-
-
Notifications
You must be signed in to change notification settings - Fork 796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stageVariables per http event #188
Comments
Hi @elgubenis, thanks for reporting this issue. Did you solve it, and if yes, how ? |
i solved it by modifying a fork of your plugin: but it has nothing to do with serverless, so i did not try to make a PR, its a very custom solution for the project im working on (its great though!) thank you so much for your plugin, it saves so much time. the final .yml syntax is functions:
status:
handler: status
events:
- http:
method: GET
path: status
handler: getStatus
- http:
method: POST
path: status
handler: setStatus like that i can have this handler in aws lambda: const restWrap = (obj) => {
return (event, context, cb) => {
const method = obj[event.handler]; // <-- thanks to the mod
return method(event, context, cb);
};
};
module.exports.status = restWrap({
getStatus: (event, context, cb) => ...,
setStatus: (event, context, cb) => ...,
}); i did all this to group rest endpoints by resource, so i dont need to have 1 aws lambda function per endpoint, so in the end i have 1 aws lambda function per function, but with many different endpoints accessing the resource |
Thanks for explaining that |
for anybody interested, i also created a serverless-plugin which deploys this behavior to the Api Gateway Method, you can find it here: https://github.com/elgubenis/serverless-event-handler sorry for the lack of documentation, yet, also the way im adding the handler to the requestTemplate is pretty ugly, i recommend not using until further... |
hi, awesome plugin
i want to define stageVariables inside every of my http events,
i did so like this:
but stageVariables is an empty object in my event argument:
https://www.dropbox.com/s/1j0po5mrjyk61l0/Screenshot%202017-01-18%2012.24.57.png?dl=0
am i missing something?
The text was updated successfully, but these errors were encountered: