Every time I start a new HTTP API on Lambda, the same discussion comes up in my team: do we give each route its own function, or do we put the whole API into one? For a long time I split everything by reflex. Today I usually start the other way round, with one function that does its own routing, and Hono has become my favourite tool for that.
If you want the complete walkthrough with all files, tests and the deployment, you can find it in my full article on running Hono on AWS Lambda with the Serverless Framework . Here I want to share the ideas behind it and the one pitfall that currently catches many people.
Why a single function can be the better default
Hono is a small TypeScript web framework that is built on the web standards Request and Response . That makes it portable: the same app runs on Cloudflare Workers, Deno, Bun, Node.js and Lambda. On Lambda, an adapter translates the API Gateway event into a normal Request and turns the response back into what API Gateway expects.β¦