Separate so hono can stay an optional peer dependency. Nothing on the main
entry knows how a request arrived, so a Worker on another framework — or none
— can use the bindings without installing Hono. Folding these two files into
the main barrel would resolve the import eagerly and make the peer mandatory
for everyone. An ESLint rule keeps Hono confined to this directory.
Registration order matters where these two meet. Hono runs middleware in
registration order and SecurityMiddleware short-circuits a rejected
request, so logToAnalytics goes first if a 401 is to leave a log
line and a metric behind. The other way round it leaves nothing.
Example
constapp = newHono()
app.use('*', logToAnalytics) // first, so rejections are still observed newSecurityMiddleware().apply(app)
The Hono delivery layer — the middleware a Worker registers on its app.
Remarks
A separate subpath, imported as
@bayudwiyansatria/cloudflare/http:Separate so
honocan stay an optional peer dependency. Nothing on the main entry knows how a request arrived, so a Worker on another framework — or none — can use the bindings without installing Hono. Folding these two files into the main barrel would resolve the import eagerly and make the peer mandatory for everyone. An ESLint rule keeps Hono confined to this directory.Registration order matters where these two meet. Hono runs middleware in registration order and SecurityMiddleware short-circuits a rejected request, so logToAnalytics goes first if a
401is to leave a log line and a metric behind. The other way round it leaves nothing.Example
Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0