Skip to content

app.use(handle),When I don't add the prefix path /admin/*, /admin in withBase does not take effect #976

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

Open
donywan opened this issue Feb 20, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@donywan
Copy link

donywan commented Feb 20, 2025

Environment

package.json

"h3-nightly": "2.0.0-20250218-184950-b59fd5f",

Reproduction

donywan/h3-template

Describe the bug

server.use(withBase('/admin', adminRoutes));

http://localhost:3000/user is work and http://localhost:3000/admin/user also is work.

Additional context

No response

Logs

@donywan donywan added the bug Something isn't working label Feb 20, 2025
@donywan donywan changed the title app.use(handle),当我不加前缀路径/admin/*,When I don't add the prefix path /admin/*, /admin in withBase does not take effect app.use(handle),When I don't add the prefix path /admin/*, /admin in withBase does not take effect Feb 20, 2025
@gulshan
Copy link
Contributor

gulshan commented Feb 20, 2025

Try using-

server.use("/admin/**", useBase("/admin", adminRoutes.handler))

@donywan
Copy link
Author

donywan commented Feb 21, 2025

Try using-

server.use("/admin/**", useBase("/admin", adminRoutes.handler))

Well,you are right,but what is mean of path /admin/**?

@donywan
Copy link
Author

donywan commented Feb 21, 2025

D:\dev>bombardier-windows-amd64.exe -c 2000 -n 2000000 http://localhost:3000/admin/user
Bombarding http://localhost:3000/admin/user with 2000000 request(s) using 2000 connection(s)
 2000000 / 2000000 [============================================================================] 100.00% 18073/s 1m50s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec     18125.34    2662.37   28404.67
  Latency      110.42ms    14.44ms      1.29s
  HTTP codes:
    1xx - 0, 2xx - 2000000, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:     3.82MB/s

D:\dev>bombardier-windows-amd64.exe -c 2000 -n 2000000 http://localhost:3000
Bombarding http://localhost:3000 with 2000000 request(s) using 2000 connection(s)
 2000000 / 2000000 [============================================================================] 100.00% 22582/s 1m28s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec     22603.48    2014.03   26856.62
  Latency       88.49ms    14.50ms      1.55s
  HTTP codes:
    1xx - 0, 2xx - 2000000, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:     4.50MB/s

Nested routing has poor performance on bun.

@nooooooooooooooon
Copy link

h3App.router.stack.push()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants