expressjs.com icon indicating copy to clipboard operation
expressjs.com copied to clipboard

express 5 router wildcard does not work as documented

Open david-gang opened this issue 1 year ago • 5 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

david-gang avatar Mar 16 '23 10:03 david-gang

@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 ?

david-gang avatar Mar 16 '23 17:03 david-gang

Hey @david-gang 👋

Thank you for your contribution 🎉

You can start this, if you are still here, please respond and I think someone will assign this to you.

IamLizu avatar Aug 14 '24 14:08 IamLizu

Hi,

I am not longer using express actively.

Sorry,

david-gang avatar Aug 16 '24 10:08 david-gang

Hey @david-gang 👋

Its fine.

In that case, I willing to fix it.

cc: @UlisesGascon

IamLizu avatar Aug 16 '24 11:08 IamLizu