Skip to main content
This release is 5 versions behind 4.7.5 — the latest version of @hono/hono. Jump to latest

@hono/hono@4.6.20
Built and signed on GitHub Actions

Web framework built on Web Standards

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
76%
Published
2 months ago (4.6.20)
I
ContextRenderer

Interface for context renderer.

I
ContextVariableMap

Interface for context variable mapping.

I
ExecutionContext

Interface for the execution context in a web worker or similar environment.

c
Hono

The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

f
accepts

Match the accept header with the given options.

f
checkUserAgentEquals
No documentation available
f
env
No documentation available
f
getRuntimeKey
No documentation available
v
knownUserAgents
No documentation available
T
Runtime
No documentation available
f
basicAuth

Basic Auth Middleware for Hono.

f
bearerAuth

Bearer Auth Middleware for Hono.

f
bodyLimit

Body Limit Middleware for Hono.

v
bunFileSystemModule
No documentation available
f
createBunWebSocket
No documentation available
v
getConnInfo

Get ConnInfo with Bun

f
serveStatic
No documentation available
v
toSSG
No documentation available
f
cache

Cache Middleware for Hono.

T
ClientRequest
No documentation available
T
ClientRequestOptions
No documentation available
T
Fetch
No documentation available
f
hc
No documentation available
T
InferRequestType
No documentation available
T
InferResponseType
No documentation available
f
handle
No documentation available
f
handleMiddleware
No documentation available
f
serveStatic
No documentation available
v
getConnInfo
No documentation available
f
serveStatic
No documentation available
v
upgradeWebSocket
No documentation available
f
every

Create a composed middleware that runs all middleware and throws an error if any of them fail.

f
except

Create a composed middleware that runs all middleware except when the condition is met.

f
some

Create a composed middleware that runs the first middleware that returns true.

f
compress

Compress Middleware for Hono.

T
AddressType
No documentation available
I
ConnInfo

HTTP Connection information

T
GetConnInfo

Helper type

T
NetAddrInfo
No documentation available
f
contextStorage

Context Storage Middleware for Hono.

f
getContext
No documentation available
f
cors

CORS Middleware for Hono.

f
csrf

CSRF Protection Middleware for Hono.

f
createCssContext
No documentation available
v
css
No documentation available
v
cx
No documentation available
v
keyframes
No documentation available
f
rawCssString
No documentation available
v
Style
No documentation available
v
viewTransition
No documentation available
v
denoFileSystemModule
No documentation available
v
getConnInfo

Get conninfo with Deno

f
serveStatic
No documentation available
v
toSSG
No documentation available
v
upgradeWebSocket
No documentation available
f
getRouterName
No documentation available
f
inspectRoutes
No documentation available
f
showRoutes
No documentation available
f
etag

ETag Middleware for Hono.

v
RETAINED_304_HEADERS

Default headers to pass through on 304 responses. From the spec:

f
createFactory
No documentation available
I
CreateHandlersInterface
No documentation available
f
createMiddleware
No documentation available
f
html
No documentation available
c
HTTPException

HTTPException must be used when a fatal error such as authentication failure occurs.

ip-restriction

IP Restriction Middleware for Hono

f
ipRestriction

IP Restriction Middleware

T
IPRestrictionRule
No documentation available
I
IPRestrictionRules

Rules for IP Restriction Middleware

T
AnimationEvent
No documentation available
T
ClipboardEvent
No documentation available
f
cloneElement
No documentation available
T
ComponentClass
No documentation available
f
createContext
No documentation available
T
CSSProperties
No documentation available
T
DragEvent
No documentation available
v
ErrorBoundary
No documentation available
T
Event
No documentation available
T
FocusEvent
No documentation available
f
Fragment
No documentation available
T
InputEvent
No documentation available
N
JSX

This code is based on React. https://github.com/facebook/react MIT License Copyright (c) Meta Platforms, Inc. and affiliates.

f
jsx
No documentation available
T
JSX.CrossOrigin
No documentation available
I
JSX.CSSProperties
No documentation available
T
KeyboardEvent
No documentation available
f
memo
No documentation available
T
MouseEvent
No documentation available
T
PointerEvent
No documentation available
T
PropsWithChildren
No documentation available
T
ReactElement

React types

T
ReactNode
No documentation available
T
TouchEvent
No documentation available
T
TransitionEvent
No documentation available
T
WheelEvent
No documentation available
f
jsxRenderer

JSX Renderer Middleware for hono.

v
RequestContext
No documentation available
f
useRequestContext

useRequestContext for Hono.

T
AnimationEvent
No documentation available
T
Child
No documentation available
v
Children
No documentation available
T
ClipboardEvent
No documentation available
f
cloneElement
No documentation available
T
ComponentClass
No documentation available
I
Context
No documentation available
f
createContext
No documentation available
f
createElement
No documentation available
f
createPortal
No documentation available
f
createRef
No documentation available
T
CSSProperties
No documentation available
T
DOMAttributes
No documentation available
T
DragEvent
No documentation available
v
ErrorBoundary
No documentation available
T
Event
No documentation available
T
FC
No documentation available
f
flushSync
No documentation available
T
FocusEvent
No documentation available
f
forwardRef
No documentation available
T
InputEvent
No documentation available
f
isValidElement
No documentation available
f
jsx
No documentation available
T
KeyboardEvent
No documentation available
f
memo
No documentation available
T
MouseEvent
No documentation available
T
PointerEvent
No documentation available
T
PropsWithChildren
No documentation available
T
ReactElement

React types

T
ReactNode
No documentation available
T
RefObject
No documentation available
f
render
No documentation available
f
startTransition
No documentation available
f
startViewTransition
No documentation available
v
Suspense
No documentation available
T
TouchEvent
No documentation available
T
TransitionEvent
No documentation available
f
use
No documentation available
f
useActionState

This hook returns the current state and a function to update the state by form action

f
useCallback
No documentation available
f
useContext
No documentation available
f
useDebugValue
No documentation available
v
useDeferredValue
No documentation available
f
useEffect
No documentation available
f
useFormStatus

This hook returns the current form status

f
useId
No documentation available
f
useImperativeHandle
No documentation available
f
useInsertionEffect
No documentation available
f
useLayoutEffect
No documentation available
f
useMemo
No documentation available
f
useOptimistic

This hook returns the current state and a function to update the state optimistically The current state is updated optimistically and then reverted to the original state when all actions are resolved

f
useReducer
No documentation available
f
useRef
No documentation available
v
useState
No documentation available
f
useSyncExternalStore
No documentation available
f
useTransition
No documentation available
f
useViewTransition
No documentation available
v
version
No documentation available
T
WheelEvent
No documentation available
f
createRoot

Create a root object for rendering

v
default
No documentation available
f
hydrateRoot

Create a root object and hydrate app to the target element. In hono/jsx/dom, hydrate is equivalent to render.

I
Root
No documentation available
T
RootOptions
No documentation available
f
createCssContext
No documentation available
v
createCssJsxDomObjects
No documentation available
v
css
No documentation available
v
cx
No documentation available
v
keyframes
No documentation available
v
Style
No documentation available
v
viewTransition
No documentation available
f
Fragment
No documentation available
f
jsxDEV
No documentation available
N
JSX
No documentation available
T
JSX.Element
No documentation available
I
JSX.ElementChildrenAttribute
No documentation available
I
JSX.IntrinsicAttributes
No documentation available
I
JSX.IntrinsicElements
No documentation available
f
jsxDEV
No documentation available
f
jsxAttr
No documentation available
f
jsxEscape
No documentation available
f
renderToReadableStream
No documentation available
v
Suspense
No documentation available
v
decode
No documentation available
f
jwt

JWT Auth Middleware for Hono.

T
JwtVariables
No documentation available
v
sign
No documentation available
v
verify
No documentation available
I
Callback
No documentation available
I
CloudFrontEdgeEvent
No documentation available
v
getConnInfo
No documentation available
f
handle
No documentation available
f
logger

Logger Middleware for Hono.

f
methodOverride

Method Override Middleware for Hono.

f
handle
No documentation available
f
poweredBy

Powered By Middleware for Hono.

f
prettyJSON

Pretty JSON Middleware for Hono.

c
Hono
No documentation available
f
requestId

Request ID Middleware for Hono.

T
RequestIdVariables
No documentation available
v
MESSAGE_MATCHER_IS_ALREADY_BUILT

Error message indicating that a route cannot be added because the matcher is already built.

v
METHOD_NAME_ALL

Constant representing all HTTP methods in uppercase.

v
METHOD_NAME_ALL_LOWERCASE

Constant representing all HTTP methods in lowercase.

v
METHODS

Array of supported HTTP methods.

T
ParamIndexMap

Type representing a map of parameter indices.

T
Params

Type representing a map of parameters.

T
ParamStash

Type representing a stash of parameters.

T
Result

Type representing the result of a route match.

I
Router

Interface representing a router.

c
UnsupportedPathError

Error class representing an unsupported path error.

c
LinearRouter
No documentation available
c
PatternRouter
No documentation available
c
RegExpRouter
No documentation available
c
SmartRouter
No documentation available
c
TrieRouter
No documentation available
T
ContentSecurityPolicyOptionHandler
No documentation available
v
NONCE
No documentation available
f
secureHeaders

Secure Headers Middleware for Hono.

T
SecureHeadersVariables
No documentation available
f
serveStatic

This middleware is not directly used by the user. Create a wrapper specifying getContent() by the environment such as Deno or Bun.

service-worker

Service Worker Adapter for Hono.

f
handle

Adapter for Service Worker

T
AfterGenerateHook
No documentation available
T
AfterResponseHook
No documentation available
T
BeforeRequestHook
No documentation available
f
combineAfterGenerateHooks
No documentation available
f
combineAfterResponseHooks
No documentation available
f
combineBeforeRequestHooks
No documentation available
v
defaultExtensionMap
No documentation available
f
disableSSG
No documentation available
f
fetchRoutesContent
No documentation available
I
FileSystemModule
No documentation available
f
isSSGContext
No documentation available
f
onlySSG
No documentation available
f
saveContentToFile
No documentation available
v
ssgParams

Define SSG Route

v
toSSG
No documentation available
I
ToSSGAdaptorInterface
No documentation available
I
ToSSGInterface
No documentation available
I
ToSSGResult
No documentation available
v
X_HONO_DISABLE_SSG_HEADER_KEY
No documentation available
I
SSEMessage
No documentation available
c
SSEStreamingApi
No documentation available
f
stream
No documentation available
f
streamSSE
No documentation available
f
streamText
No documentation available
f
testClient
No documentation available
T
HTTPExceptionFunction
No documentation available
f
timeout

Timeout Middleware for Hono.

f
endTime

End a timer for the timing middleware.

v
setMetric

Set a metric for the timing middleware.

f
startTime

Start a timer for the timing middleware.

f
timing

Server-Timing Middleware for Hono.

T
TimingVariables
No documentation available
c
Hono
No documentation available
f
appendTrailingSlash

Append trailing slash middleware for Hono. Append a trailing slash to the URL if it doesn't have one. For example, /path/to/page will be redirected to /path/to/page/.

f
trimTrailingSlash

Trailing Slash Middleware for Hono.

T
AddParam
No documentation available
T
Bindings
No documentation available
T
BlankEnv
No documentation available
T
BlankInput
No documentation available
T
BlankSchema
No documentation available
T
Endpoint
No documentation available
T
Env
No documentation available
T
ErrorHandler
No documentation available
T
ExtractInput
No documentation available
T
ExtractSchema
No documentation available
T
FormValue
No documentation available
T
H
No documentation available
T
Handler
No documentation available
I
HandlerInterface
No documentation available
T
HandlerResponse
No documentation available
I
HTTPResponseError
No documentation available
T
Input
No documentation available
T
InputToDataByTarget
No documentation available
T
IntersectNonAnyTypes
No documentation available
T
KnownResponseFormat
No documentation available
T
MergePath
No documentation available
T
MergeSchemaPath
No documentation available
T
MiddlewareHandler
No documentation available
I
MiddlewareHandlerInterface
No documentation available
T
Next
No documentation available
T
NotFoundHandler
No documentation available
I
OnHandlerInterface
No documentation available
T
ParamKeys
No documentation available
T
ParamKeyToRecord
No documentation available
T
ParsedFormValue
No documentation available
T
RemoveQuestion
No documentation available
T
ResponseFormat
No documentation available
I
RouterRoute
No documentation available
T
Schema
No documentation available
T
ToSchema
No documentation available
T
TypedResponse
No documentation available
T
Variables
No documentation available
T
BodyData
No documentation available
v
parseBody
No documentation available
T
ParseBodyOptions
No documentation available
f
bufferToFormData
No documentation available
f
bufferToString
No documentation available
f
equal
No documentation available
f
timingSafeEqual
No documentation available
f
getColorEnabled

Get whether color change on terminal is enabled or disabled. If NO_COLOR environment variable is set, this function returns false.

f
createPool
No documentation available
I
Pool
No documentation available
T
CookieConstraint
No documentation available
T
CookieOptions
No documentation available
T
CookiePrefixOptions
No documentation available
f
parse
No documentation available
f
parseSigned
No documentation available
f
serialize
No documentation available
f
serializeSigned
No documentation available
T
SignedCookie
No documentation available
f
createHash
No documentation available
f
md5
No documentation available
f
sha1
No documentation available
f
sha256
No documentation available
f
decodeBase64
No documentation available
f
decodeBase64Url
No documentation available
f
encodeBase64
No documentation available
f
encodeBase64Url
No documentation available
f
getFilePath
No documentation available
f
getFilePathWithoutDefaultDocument
No documentation available
f
findTargetHandler
No documentation available
f
isMiddleware
No documentation available
T
AcceptHeader
No documentation available
T
CustomHeader
No documentation available
T
RequestHeader
No documentation available
T
ResponseHeader
No documentation available
f
escapeToBuffer
No documentation available
T
HtmlEscaped
No documentation available
T
HtmlEscapedCallback
No documentation available
T
HtmlEscapedString
No documentation available
f
raw
No documentation available
f
resolveCallback
No documentation available
f
resolveCallbackSync
No documentation available
T
StringBuffer

StringBuffer contains string and Promise alternately The length of the array will be odd, the odd numbered element will be a string, and the even numbered element will be a Promise. When concatenating into a single string, it must be processed from the tail.

f
stringBufferToString
No documentation available
T
StringBufferWithCallbacks
No documentation available
T
ClientErrorStatusCode
No documentation available
T
ContentfulStatusCode
No documentation available
T
ContentlessStatusCode
No documentation available
T
DeprecatedStatusCode
No documentation available
T
InfoStatusCode
No documentation available
T
RedirectStatusCode
No documentation available
T
ServerErrorStatusCode
No documentation available
T
StatusCode

If you want to use an unofficial status, use UnofficialStatusCode.

T
SuccessStatusCode
No documentation available
T
UnofficialStatusCode

UnofficialStatusCode can be used to specify an unofficial status code.

T
UnOfficalStatusCode
No documentation available

utils/ipaddr

Utils for IP Addresses

f
convertIPv4BinaryToString

Convert a binary representation of an IPv4 address to a string.

f
convertIPv4ToBinary

Convert IPv4 to Uint8Array

f
convertIPv6BinaryToString

Convert a binary representation of an IPv6 address to a string.

f
convertIPv6ToBinary

Convert IPv6 to Uint8Array

f
distinctRemoteAddr

Distinct Remote Addr

f
expandIPv6

Expand IPv6 Address

v
Jwt
No documentation available
E
AlgorithmTypes
No documentation available
T
SignatureAlgorithm
No documentation available
T
SignatureKey
No documentation available
f
signing
No documentation available
f
verifying
No documentation available
f
decode
No documentation available
f
isTokenHeader
No documentation available
f
sign
No documentation available
I
TokenHeader
No documentation available
f
verify
No documentation available
E
CryptoKeyUsage
No documentation available
c
JwtAlgorithmNotImplemented
No documentation available
c
JwtHeaderInvalid
No documentation available
T
JWTPayload

JWT Payload

c
JwtTokenExpired
No documentation available
c
JwtTokenInvalid
No documentation available
c
JwtTokenIssuedAt
No documentation available
c
JwtTokenNotBefore
No documentation available
c
JwtTokenSignatureMismatched
No documentation available
v
utf8Decoder
No documentation available
v
utf8Encoder
No documentation available
T
BaseMime

Union types for BaseMime

f
getExtension
No documentation available
f
getMimeType
No documentation available
v
mimes
No documentation available
T
Equal
No documentation available
T
Expect
No documentation available
T
HasRequiredKeys
No documentation available
T
IfAnyThenEmptyObject
No documentation available
T
InterfaceToType
No documentation available
T
InvalidJSONValue
No documentation available
T
IsAny
No documentation available
T
JSONArray
No documentation available
T
JSONObject
No documentation available
T
JSONParsed
No documentation available
T
JSONPrimitive
No documentation available
T
JSONValue
No documentation available
T
NotEqual
No documentation available
T
RemoveBlankRecord
No documentation available
T
RequiredKeysOf
No documentation available
T
Simplify

Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.

T
SimplifyDeepArray

A simple extension of Simplify that will deeply traverse array elements.

T
StringLiteralUnion

String literal types with auto-completion

T
UnionToIntersection
No documentation available
f
checkOptionalParameter
No documentation available
v
decodeURIComponent_
No documentation available
f
getPath
No documentation available
f
getPathNoStrict
No documentation available
f
getPattern
No documentation available
f
getQueryParam
No documentation available
f
getQueryParams
No documentation available
f
getQueryStrings
No documentation available
f
mergePath
No documentation available
T
Pattern
No documentation available
f
splitPath
No documentation available
f
splitRoutingPath
No documentation available
f
tryDecode
No documentation available
T
ValidationFunction
No documentation available
f
validator
No documentation available
v
getConnInfo
No documentation available
f
handle
No documentation available
f
createWSMessageEvent
No documentation available
f
defineWebSocketHelper

Create a WebSocket adapter/helper

I
SendOptions

Options for sending message

T
UpgradeWebSocket

Upgrade WebSocket Type

I
WebSocketHelperDefineContext
No documentation available
T
WebSocketHelperDefineHandler
No documentation available
c
WSContext

A context for controlling WebSockets

I
WSContextInit

An argument for WSContext class

I
WSEvents

WebSocket Event Listeners type

T
WSMessageReceive
No documentation available
T
WSReadyState

ReadyState for WebSocket