New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some router paths don't work if router is mounted after defining routes #278
Comments
@talentlessguy has funded $5.00 to this issue.
|
This might not be the correct way to solve this (and might possibly break other things?) but in the pushMiddleware(this.middleware)({
path: base as string,
regex,
type: 'mw',
handler: mount(fns[0] as Handler),
handlers: fns.slice(1).map(mount),
fullPaths: fns
.flat()
.map((fn) =>
- fn instanceof App && fn.middleware?.[0] ? lead(base as string) + lead(fn.middleware?.[0].path) : ''
+ fn instanceof App && fn.middleware?.length ? fn.middleware.map(mv => lead(base as string) + lead(mv.path)) : ''
)
}) |
@weedz could you please fork it and check on some unit tests for router? |
Sure |
Does not seem to work. Fails at
Returns "Not Found" for /abc/route2 and /abc/route3 |
@talentlessguy has rewarded $4.50 to @sbencoding. See it on IssueHunt
|
Describe the bug
Can not find the correct route when using sub-apps.
To Reproduce
Steps to reproduce the behavior:
The following code does not work as intended:
I can't request
/router/find
but/router/list
works.If I instead "use"
router
before we define any routes it works:Expected behavior
Should not matter where the
use
is called? When requesting/router/find
you should seerouter/find
instead ofNot Found
.Versions
node
: 14.16.1@tinyhttp/app
: 1.3.11Additional context
Add any other context about the problem here.
IssueHunt Summary
sbencoding has been rewarded.
Backers (Total: $5.00)
Submitted pull Requests
Tips
The text was updated successfully, but these errors were encountered: