0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-30 01:56:18 +01:00
hono/deno_dist/router.ts

17 lines
477 B
TypeScript
Raw Normal View History

2022-07-02 08:09:45 +02:00
export const METHOD_NAME_ALL = 'ALL' as const
export const METHOD_NAME_ALL_LOWERCASE = 'all' as const
export const METHODS = ['get', 'post', 'put', 'delete', 'options', 'patch'] as const
2022-07-02 08:09:45 +02:00
export interface Router<T> {
name: string
2022-07-02 08:09:45 +02:00
add(method: string, path: string, handler: T): void
match(method: string, path: string): Result<T> | null
}
export interface Result<T> {
handlers: T[]
params: Record<string, string>
}
export class UnsupportedPathError extends Error {}