Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,15 @@ app.listen(80, function () {
})
```

You can also enable pre-flight across-the-board like so:
You can also enable pre-flight across-the-board in Express 5 like so:

```javascript
app.options('*', cors()) // include before other routes
app.options('/{*splat}', cors()) // include before other routes
```

Express 5 requires a named wildcard. The braces in `/{*splat}` also match
the root path (`/`). In Express 4, use `app.options('*', cors())` instead.

NOTE: When using this middleware as an application level middleware (for
example, `app.use(cors())`), pre-flight requests are already handled for all
routes.
Expand Down