0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-29 17:46:30 +01:00
hono/deno_dist/hono.ts
Yusuke Wada 677b572fd5 feat: introduce PatternRouter and hono/tiny (#1036)
* wip

* Use RegExp instead of URLPattern. (#1039)

* Use RegExp instead of URLPattern.

* refactor(url-pattern-router): tidy up.

* refactor(url-pattern-router): Tweaks type for mangling.

* refactor: Rename URLPatternRouter to PatternRouter.

* chore: denoify.

---------

Co-authored-by: Taku Amano <taku@taaas.jp>
2023-04-28 12:10:20 +09:00

19 lines
574 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' | 'strict'>> = {}) {
super(init)
this.router = new SmartRouter({
routers: [new RegExpRouter(), new TrieRouter()],
})
}
}