/Knowledge/sources/honojs__hono/llms-full/middleware-execution-order--f4c201d53758.md
Middleware: Execution order - hono-docs
Middleware: Execution order Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt execution order Summary Th...
Middleware: Execution order
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#execution-order
Summary
The order in which Middleware is executed is determined by the order in which it is registered. The process before the next of the first registered Middleware is executed first, and the process after the next is executed last. See be...
Content
The order in which Middleware is executed is determined by the order in which it is registered.
The process before the next of the first registered Middleware is executed first,
and the process after the next is executed last.
See below.
app.use(async (_, next) => {
console.log('middleware 1 start')
await next()
console.log('middleware 1 end')
})
app.use(async (_, next) => {
console.log('middleware 2 start')
await next()
console.log('middleware 2 end')
})
app.use(async (_, next) => {
console.log('middleware 3 start')
await next()
console.log('middleware 3 end')
})
app.get('/', (c) => {
console.log('handler')
return c.text('Hello!')
})
Result is the following.
middleware 1 start
middleware 2 start
middleware 3 start
handler
middleware 3 end
middleware 2 end
middleware 1 end
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#execution-order",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Middleware > Execution order (1)",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 113,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Middleware: Execution order",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}