docs: document req.params changes in 5.x
Fixes #2090
Deploy Preview for expressjscom-preview ready!
| Name | Link |
|---|---|
| Latest commit | b7d13cfeb038c44493697970e534547ff7dc0242 |
| Latest deploy log | https://app.netlify.com/projects/expressjscom-preview/deploys/6944b01af5f04f0008903599 |
| Deploy Preview | https://deploy-preview-2092--expressjscom-preview.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
🚦 Lighthouse Results (Mobile & Desktop)
| URL | Device | Perf | A11y | Best Practices |
|---|---|---|---|---|
| / | mobile | 🔴 70 | 🟢 100 | 🟢 96 |
| /en/blog/posts.html | mobile | 🔴 73 | 🟢 96 | 🟢 96 |
| /en/5x/api.html | mobile | 🟠 75 | 🟢 95 | 🟢 96 |
| / | desktop | 🟢 100 | 🟢 100 | 🟢 96 |
| /en/blog/posts.html | desktop | 🟢 100 | 🟢 96 | 🟢 92 |
| /en/5x/api.html | desktop | 🟢 99 | 🟢 95 | 🟢 96 |
Just one thing that I remembered - req.params has null prototype, unless the path is a regular expression. With regexes req.params is a normal object (see regexpMatcher in router)
Your suggestion is definitely clearer. I'll admit that I'm not great at writing documentation.
There is just the question about prototype that may or may not be null... I did not notice it initially and forgot to update the PR when I tested some more things and realised that regular expressions have req.params with a regular Object prototype. To be fair this inconsistency is probably something that should be changed in router.
There is just the question about prototype that may or may not be null... I did not notice it initially and forgot to update the PR when I tested some more things and realised that regular expressions have req.params with a regular Object prototype. To be fair this inconsistency is probably something that should be changed in router.
yep, when it's not regexp then the object is created here, whereas here is where the object is created, probably we should change that in the router so both ways are the same