0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-25 13:19:30 +01:00
hono/benchmarks/routers/src/medley-router.mts
2023-01-29 14:10:47 +09:00

20 lines
471 B
TypeScript

import Router from '@medley/router'
import type { RouterInterface } from './tool.mts'
import { routes, handler } from './tool.mts'
const name = '@medley/router'
const router = new Router()
for (const route of routes) {
const store = router.register(route.path)
store[route.method] = handler
}
export const medleyRouter: RouterInterface = {
name,
match: (route) => {
const match = router.find(route.path)
match.store[route.method] // get handler
},
}