expressjs / expressjs.com

Home Page:https://expressjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

express 5 router wildcard does not work as documented

david-gang opened this issue · comments

Hi,

The following does not work as written in the documentation:
https://expressjs.com/en/5x/api.html

app.all('*', requireAuthentication, loadUser)

This is because you are at a newer version of path-to-regexp

https://github.com/pillarjs/path-to-regexp#compatibility-with-express--4x

so please update the documentation because this works

app.all('(.*)', requireAuthentication, loadUser)

I think that also the migration doc should reflect this change.

Thanks

@dougwilson I could open a PR with the documentation changes. English is not my mother tongue so i would prefer that a native english speaker will review the PR. What do you think ?