2023-04-26 01:15:45 +00:00
|
|
|
import { HonoBase } from './hono-base.ts'
|
2022-09-12 11:49:18 +00:00
|
|
|
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'
|
2023-04-26 01:15:45 +00:00
|
|
|
import type { Env } from './types.ts'
|
2022-07-02 06:09:45 +00:00
|
|
|
|
2023-05-13 23:18:45 +00:00
|
|
|
export class Hono<E extends Env = Env, S = {}, BasePath extends string = '/'> extends HonoBase<
|
2023-04-26 01:15:45 +00:00
|
|
|
E,
|
|
|
|
S,
|
|
|
|
BasePath
|
|
|
|
> {
|
2023-05-03 13:13:23 +00:00
|
|
|
constructor(init: Partial<Pick<Hono, 'router' | 'getPath'> & { strict: boolean }> = {}) {
|
2023-04-26 01:15:45 +00:00
|
|
|
super(init)
|
2023-05-09 12:50:43 +00:00
|
|
|
this.router =
|
|
|
|
init.router ??
|
|
|
|
new SmartRouter({
|
|
|
|
routers: [new RegExpRouter(), new TrieRouter()],
|
|
|
|
})
|
2022-07-02 06:09:45 +00:00
|
|
|
}
|
|
|
|
}
|