0
0
mirror of https://github.com/honojs/hono.git synced 2024-12-01 11:51:01 +01:00
hono/deno_dist/hono.ts
Yusuke Wada d9aca261a1
fix: enable specifying router from args (#1079)
* fix: enable specifying router from args

* add tests

* denoify
2023-05-09 21:50:43 +09:00

21 lines
628 B
TypeScript

import { HonoBase } from './hono-base.ts'
import { RegExpRouter } from './router/reg-exp-router/index.ts'
import { SmartRouter } from './router/smart-router/index.ts'
import { TrieRouter } from './router/trie-router/index.ts'
import type { Env } from './types.ts'
export class Hono<E extends Env = Env, S = {}, BasePath extends string = ''> extends HonoBase<
E,
S,
BasePath
> {
constructor(init: Partial<Pick<Hono, 'router' | 'getPath'> & { strict: boolean }> = {}) {
super(init)
this.router =
init.router ??
new SmartRouter({
routers: [new RegExpRouter(), new TrieRouter()],
})
}
}