diff --git a/docs/content/docs/installation.mdx b/docs/content/docs/installation.mdx index 0fcee8f337..2ea3cff6ce 100644 --- a/docs/content/docs/installation.mdx +++ b/docs/content/docs/installation.mdx @@ -302,6 +302,18 @@ Better Auth supports any backend framework with standard Request and Response ob + + 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.* + + ```ts title="server.ts" import express from "express"; import { toNodeHandler } from "better-auth/node";