Multiple Functions From Same Source Crate
zprobst opened this issue · 4 comments
Is there a way to create multiple different lambda handlers in the same create? I have two lambda functions that are almost entirely the same source but one can come from an HTTP event and one from a step function. Any good / accepted pattern for doing this or is multiple crates the way to go?
I haven’t really thought of an approach, but I think placing each function’s entrypoint in a bin/
directory and having shared code in src/
would address this use-case pretty well. Cargo should model this pattern well natively.
Cargo workspaces should also work out of the box. Here's an example https://github.com/softprops/serverless-aws-rust-multi
Thanks guys! I think I am leaning towards the workspaces approach. Seems like I missed that when going through the readme but I see it now! Thanks for the quick response.