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