Skip to content

docs: improve discoverability of wildcard parameters#2451

Open
Akshay4754 wants to merge 6 commits into
expressjs:mainfrom
Akshay4754:docs/wildcard-route-parameters
Open

docs: improve discoverability of wildcard parameters#2451
Akshay4754 wants to merge 6 commits into
expressjs:mainfrom
Akshay4754:docs/wildcard-route-parameters

Conversation

@Akshay4754

Copy link
Copy Markdown

Summary

This PR improves the discoverability of wildcard parameters in the Express 5 Route parameters documentation.

Instead of duplicating the existing wildcard documentation, it adds a short note that points readers to the existing Wildcards section.

Fixes #1891

@Akshay4754
Akshay4754 requested a review from a team as a code owner July 18, 2026 21:59
@netlify

netlify Bot commented Jul 18, 2026

Copy link
Copy Markdown

Deploy Preview for expressjscom-preview ready!

Name Link
🔨 Latest commit fa31c8a
🔍 Latest deploy log https://app.netlify.com/projects/expressjscom-preview/deploys/6a63db43056b18000894d391
😎 Deploy Preview https://deploy-preview-2451--expressjscom-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (🟢 up 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

});
```

Wildcard parameters (`*`) are also supported in Express 5. Unlike named parameters (`:`), they capture one or more path segments and expose them as an array in `req.params`. See the [Wildcards](#wildcards) section above for details and examples.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Wildcard parameters (`*`) are also supported in Express 5. Unlike named parameters (`:`), they capture one or more path segments and expose them as an array in `req.params`. See the [Wildcards](#wildcards) section above for details and examples.
<Alert type="info">
Wildcard parameters (`*`) are only supports in Express 5. Unlike named parameters (`:`), they capture one or more path segments and expose them as an array in `req.params`. See the [Wildcards](#wildcards) section above or [migration guide](https://expressjs.com/en/guide/migrating-5/#path-route-matching-syntax) for details and examples.
<Alert>

Add abouve note on page: https://expressjs.com/en/5x/api/request/#reqparams

Some extra, but not necessary. Add alert not on 4x doc https://expressjs.com/en/4x/api/request/#reqparams

<Alert type="alert">
Wildcard parameters (`*`) are introduced in Express 5. Unlike named parameters (`:`), they capture one or more path segments and expose them as an array in `req.params`. See the [migration guide to 5x](https://expressjs.com/en/guide/migrating-5/#path-route-matching-syntax) for details.
<Alert>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review!

I've addressed the requested changes by:

  • Wrapping the wildcard parameter note in an Alert component.
  • Adding the wildcard parameter note to the Express 5 req.params documentation with a link to the migration guide.
  • Adding the suggested notice to the Express 4 req.params documentation.

Please let me know if there are any further changes or improvements you'd like me to make. Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this wording is clear. In 4.x there are wildcard parameters, but with no explicit names. These can still be accessed from req.params (so I'd argue that they are parameters) under integer keys (in most cases there's just one unnamed parameter so - req.params[0]). In 4.x wildcards return strings instead of string[] like in 5.x.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out! That's a good clarification. I'll update the wording to distinguish the Express 4 behavior (req.params[0] returning a string) from the named wildcard parameters introduced in Express 5.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this is best fit.

<Alert type="info">
In Express 4, wildcards (`*`) are unnamed, whereas in Express 5, wildcards must be explicitly named (e.g., `/*splat`). Please check the [migration guide to 5.x](https://expressjs.com/en/guide/migrating-5/#path-route-matching-syntax) before upgrading your routes.
</Alert>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've updated the wording accordingly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly tell if anything else is required. Thanks

Comment thread src/content/api/4x/api/request/index.mdx Outdated

@krzysdz krzysdz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5.x docs (API and routing guide) still claim that only Express 5 supports wildcards.


<Alert type="info">

Wildcard parameters (`*`) are only supported in Express 5. Unlike named parameters (`:`), they capture one or more path segments and expose them as an array in `req.params`. See the [Wildcards](#wildcards) section above or the [migration guide](https://expressjs.com/en/guide/migrating-5/#path-route-matching-syntax) for details and examples.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to say "Express 5" anymore. The guides are versioned, so that redundancy isn't necessary

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I've simplified the wording by removing the redundant "Express 5" reference from the versioned guides while keeping the migration guide reference.

@bjohansebas bjohansebas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I need to take a closer look at this. I feel like we're breaking the reading flow, so I'll briefly block it for now

@Akshay4754
Akshay4754 force-pushed the docs/wildcard-route-parameters branch from 37336e9 to fa31c8a Compare July 24, 2026 21:38
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

Successfully merging this pull request may close these issues.

Missing documentation for wildcard parameters

4 participants