Skip to content

The Path examples documentation is misleading #1892

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
jjspace opened this issue May 1, 2025 · 0 comments
Open

The Path examples documentation is misleading #1892

jjspace opened this issue May 1, 2025 · 0 comments

Comments

@jjspace
Copy link

jjspace commented May 1, 2025

Description

In the documentation for Path examples, which is linked to from every other method like app.get or app.use, the descriptions are misleading. Each of the examples starts with:

This will match paths starting with...

Which seems to indicate that the handler set up on a route will trigger for every path that starts with that string instead of only exact matches which is how it actually works.

For the first example:

This will match paths starting with /abcd:

 app.use('/abcd', (req, res, next) => {
   next()
 })

As read, this seems to indicate it will trigger for routes like /abcde or /abcd/efg or /abcd/efg/123.js which is not the case.

I do understand there may be some small caveat here when mixing in the actual Routing class where it will handle nested or combined paths but that should have it's own notes or mention in the documentation. As it's currently written that is not clear.

Expectations

The path syntax should be explicit about how it works. By default the assumption after reading is that paths are exact matches unless doing something special with path patterns or wildcards or regular expressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant