Kind: Constant
Source: src/router.ts
Array of supported HTTP methods.
METHODS is an array of HTTP methods supported by the router. It acts as the method allowlist used when routing incoming requests and validating method-specific behavior.
Definition
ts['get', 'post', 'put', 'delete', 'options', 'patch', 'query'] as const
Value
ts['get', 'post', 'put', 'delete', 'options', 'patch', 'query'] as const
Diagram
mermaidgraph LR Request[Incoming request] --> Method[HTTP method] Method --> Methods[METHODS] Methods --> Router[Router handling]
Usage
tsimport { METHODS } from "./router";
function supportsMethod(method: string): boolean {
return METHODS.includes(method);
}
if (supportsMethod(request.method)) {
// Route the request
}
AI Coding Instructions
- Keep
METHODSaligned with the HTTP methods handled by the router. - Check request methods against
METHODSbefore dispatching route handlers. - Update method-specific routing logic when adding or removing entries from
METHODS. - Preserve the constant as the shared source of truth for supported methods.
Used by
1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Imported by (1)
HonoOptions—src/hono-base.ts:46
Was this page helpful?