Hono
@dotpress/adapter-hono runs your app on Hono 4.13 or later, on Node.js and AWS Lambda. Hono 5 is tested against its release candidate.
On Node.js
The @dotpress/adapter-hono/node entry serves the app with @hono/node-server. The main entry, @dotpress/adapter-hono, has no Node.js server: it is the one to use on AWS Lambda, where the bundle stays small.
Options
Hono middlewares
The Hono example shares its adapter options between Node.js and AWS Lambda, with a native middleware and a native route:
Behavior
- Routes are matched by Dotpress, with the same rules on every adapter: Hono options such as
strictdo not apply. Use thebasePathoption ofcreateApp()rather thanapp.basePath(). - Bodies are read by the adapter: JSON, forms, text and multipart uploads. A body already read by a native middleware through Hono (
c.req.json(),c.req.parseBody()…) is taken from its cache. Routes declared withrawBody: trueneed the exact bytes: let the adapter read the body, or read it withc.req.arrayBuffer()orc.req.blob()in a native middleware. HTTPExceptionclient errors (4xx) thrown by native middlewares use the Dotpress error format and keep their status, message and headers (theWWW-Authenticateheader ofbearerAuth()…). Other errors are unexpected (500). The adapter takes overapp.notFound()andapp.onError().ctx.req.ipdoes not read proxy headers such asX-Forwarded-For: behind a proxy, read them ingetIp(c), and only trust the proxies you run.ctx.rawis the Hono context.close()waits for pending requests and closes the responses being streamed;adapter.server()returns the Node.js HTTP server.
Other runtimes
The main entry only relies on Hono and Web-standard APIs. adapter.fetch handles a Web Request, like app.fetch in Hono, for runtimes that take a fetch handler:
Dotpress 2.0 is tested on Node.js and AWS Lambda only: other runtimes (Bun, Deno, edge runtimes) are not officially supported yet. See the design decision.
On AWS Lambda
The same app runs on AWS Lambda with createLambdaHandler() of @dotpress/adapter-hono/lambda: see AWS Lambda.