back

by helsinkiandrew·6y ago·view on hn ↗
> With the Lambda server-less paradigm, you end up with 1 lambda function per route

I’m not sure why this is the case. You could host all modules in the same lambda endpoint /api/v1/* Using the same technology you would use with any other backend

5 comments
I use Api gateway to redirect to a regular Flask lambda with all the endpoints
Yeah, we use https://github.com/awslabs/aws-serverless-express/ which solves the problem of multiple routes and running an express app locally.
Yeah I use ASP.NET Core Lambda.

Article's comments don't seem well researched. Just used tech. Ran into road block. Blogged. Complained.

I was going to say the same. For smaller apps, just build a monolith as a function and proxy all routes to it from API Gateway. If microservices based app, each resource or route mapped to a function like what he mentioned is common though.
You will end up needing to provisiom lambda size to the worst case of any one function. You need to split them if you want to use resources efficiently according to what the functions do.
Agreed, this is the biggest issue with lambda for me - particularly Lambda Edge instances.

But I find it's the dependencies and common code that takes most of the space which often is common with all functions.

Agreed, and even if do want to use a different lambda per route, it's not as troublesome to setup as the author claims.
Yeah a swagger file broken up with multi-file-swagger npm module works great
Thanks for the reference. I’ve been looking to solve a problem in this space and that’s perfect.
This has been amazing for the ApiGateway swagger files. There is quite a bit of duplication and splitting it up let's us only write the common stuff one time.. error code handling, common request templates, etc...