Multiple handlers per function


I would like to know if it’s possible to declare multiple handlers per function. I’m looking to follow “Services Pattern” from this guide: but I would like to not manage the routing in the lambda but directly through API Gateway using multiple handlers per Lambda


AWS only allows you to define one handler per Lambda function. To implement the services pattern you need to implement a router inside your handler. If you want to see how I’m doing it I’ve written a blog post about Routing API Gateway Traffic Through One Lamda Function with example code.


Thanks for your help! That’s what we need!

It seems that serverless no longer supports duplicate event types in a single function. I implemented your code and got an error related to duplicate -http events. Is there an update to this approach or did I miss something?