Skip to content

The Path examples documentation is misleading #1892

@jjspace

Description

@jjspace

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions