fix(medley-router): support new path matching (#249)
* fix(medley-router): support new path matching * add changesetpull/250/head
parent
545997181f
commit
139504a145
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@hono/medley-router': patch
|
||||
---
|
||||
|
||||
fix: support new path matching
|
|
@ -25,12 +25,12 @@
|
|||
},
|
||||
"homepage": "https://github.com/honojs/middleware",
|
||||
"peerDependencies": {
|
||||
"hono": "*"
|
||||
"hono": ">=3.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"hono": "^3.2.6"
|
||||
"hono": "^3.9.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@medley/router": "^0.2.1"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,16 +17,13 @@ export class MedleyRouter<T> implements Router<T> {
|
|||
store[method] = handler
|
||||
}
|
||||
|
||||
match(method: string, path: string): Result<T> | null {
|
||||
match(method: string, path: string): Result<T> {
|
||||
const route = this.router.find(path)
|
||||
|
||||
if (route) {
|
||||
return {
|
||||
handlers: [route['store'][method]],
|
||||
params: route['params'],
|
||||
}
|
||||
return [[[route['store'][method]], route['params']]]
|
||||
}
|
||||
|
||||
return null
|
||||
return [[], []]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6147,7 +6147,7 @@ heap-js@^2.2.0:
|
|||
resolved "https://registry.yarnpkg.com/heap-js/-/heap-js-2.3.0.tgz#8eed2cede31ec312aa696eef1d4df0565841f183"
|
||||
integrity sha512-E5303mzwQ+4j/n2J0rDvEPBN7GKjhis10oHiYOgjxsmxYgqG++hz9NyLLOXttzH8as/DyiBHYpUrJTZWYaMo8Q==
|
||||
|
||||
hono@^3.0.0, hono@^3.1.0, hono@^3.1.2, hono@^3.1.5, hono@^3.2.6, hono@^3.5.1, hono@^3.5.2, hono@^3.5.8, hono@^3.7.2, hono@^3.7.3, hono@^3.9.1, hono@^3.9.2:
|
||||
hono@^3.0.0, hono@^3.1.0, hono@^3.1.2, hono@^3.1.5, hono@^3.5.1, hono@^3.5.2, hono@^3.5.8, hono@^3.7.2, hono@^3.7.3, hono@^3.9.1, hono@^3.9.2:
|
||||
version "3.9.2"
|
||||
resolved "https://registry.yarnpkg.com/hono/-/hono-3.9.2.tgz#db31a6ce733131ee16bce0c9bd031a0708ebe052"
|
||||
integrity sha512-180NOiMadqU3lGmN6ajPDZvZPWus3a9mtVaAUR9uG0SImngBwRLA8vbnV0oUfUAgFT4nX55sGV9dVA06OuikHA==
|
||||
|
|
Loading…
Reference in New Issue