Kind: Function
Source: src/adapter/bun/conninfo.ts
Part of: Adapter
Get ConnInfo with Bun
getConnInfo reads connection details for the current request when running on Bun. It is intended for handlers that need access to request connection metadata through the Bun adapter.
Signature
tsfunction getConnInfo(c: Context)
Parameters
| Name | Type |
|---|---|
c | Context |
Diagram
mermaidgraph LR Request --> Context Context --> getConnInfo getConnInfo --> BunServer BunServer --> ConnInfo ConnInfo --> Handler
Usage
tsimport { Hono } from 'hono'
import { getConnInfo } from 'hono/bun'
const app = new Hono()
app.get('/connection', (c) => {
const connInfo = getConnInfo(c)
return c.json(connInfo)
})
export default app
AI Coding Instructions
- Call
getConnInfofrom a request handler with the active Hono context. - Use this Bun-specific helper only when the application is running with the Bun adapter.
- Keep connection metadata handling separate from request parsing and response creation.
- Handle missing or unavailable connection details before relying on them for application logic.
Relationships
- IMPORTS →
getBunServer
Was this page helpful?