Skip to content

docs: update pre-flight cors example according to v5 #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

IamLizu
Copy link
Member

@IamLizu IamLizu commented Jun 27, 2025

@IamLizu IamLizu added the docs label Jun 27, 2025
@ctcpip
Copy link
Member

ctcpip commented Jun 27, 2025

express v4 is still supported (and has far more usage than v5 still). therefore, can you please update to show both examples?

@IamLizu IamLizu requested a review from ctcpip June 27, 2025 20:23
For express v5,
```javascript
// Catch every non-root path
app.options('/*splat', cors());
Copy link
Member

Choose a reason for hiding this comment

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

For most users, if not all, the root path is needed, so I think we should remove this.

Suggested change
app.options('/*splat', cors());

Copy link
Member Author

Choose a reason for hiding this comment

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

Example covering root path is also there if you read the next one or two line and both cases are clearly indicated with comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allows CORS for any routes, including OPTIONS: documentation is obsolete
3 participants