Closed medz closed 1 month ago
Bun
import { createRouter, addRoute, findAllRoutes } from "rou3"; const router = createRouter(); addRoute(router, "get", "/path", "Static"); addRoute(router, "get", "/path/:name", "Param"); console.log(findAllRoutes(router, "get", "/path"));
Register two routes: /path and /path/:name, or add another route: /path/:bar/:qaz
/path
/path/:name
/path/:bar/:qaz
Use /path to call findAllRoutes, and the result includes /path/:name and /path/:bar/:qaz routes.
findAllRoutes
No response
[ { data: "Param", params: { name: undefined, }, }, { data: "Static", params: undefined, } ]
Thanks for report i kinda forgot to do it for findAll too before release. We need to do similar fix of #123. (feel free to PR)
Environment
Bun
Reproduction
Describe the bug
Register two routes:
/path
and/path/:name
, or add another route:/path/:bar/:qaz
Use
/path
to callfindAllRoutes
, and the result includes/path/:name
and/path/:bar/:qaz
routes.Additional context
No response
Logs