mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-19 23:53:17 -05:00
chore: Add ExpressJS v5 implementation disclaimer
This commit is contained in:
@@ -302,6 +302,18 @@ Better Auth supports any backend framework with standard Request and Response ob
|
||||
</Tab>
|
||||
|
||||
<Tab value="express">
|
||||
<Callout type="warn">
|
||||
ExpressJS v5 introduced breaking changes to route path matching by switching to `path-to-regexp@6`. Wildcard routes like `*` should now be written using the new named syntax, e.g. `/{*any}`, to properly capture catch-all patterns. This ensures compatibility and predictable behavior across routing scenarios.
|
||||
See the [Express v5 migration guide](https://expressjs.com/en/guide/migrating-5.html) for details.
|
||||
|
||||
As a result, the implementation in ExpressJS v5 should look like this:
|
||||
|
||||
```ts
|
||||
app.all('/api/auth/{*any}', toNodeHandler(auth));
|
||||
```
|
||||
*The name any is arbitrary and can be replaced with any identifier you prefer.*
|
||||
</Callout>
|
||||
|
||||
```ts title="server.ts"
|
||||
import express from "express";
|
||||
import { toNodeHandler } from "better-auth/node";
|
||||
|
||||
Reference in New Issue
Block a user