Menu

One Lambda, Many Routes: Why I Reach for Hono First
πŸ“°

One Lambda, Many Routes: Why I Reach for Hono First

DEV Community: serverlessΒ·Sascha Mirow-StanitzokΒ·3 days ago
#kz8pm6RJ
#devtoserverless#devto#dev#lambda#hono
Long article (835 words) β€” no AI summary yet.
Reading 0:00
15s threshold

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.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.