mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 12:27:44 +00:00
docs: update nuxt catch-all route to match example
This commit is contained in:
@@ -7,9 +7,9 @@ Before you start, make sure you have a Better Auth instance configured. If you h
|
|||||||
|
|
||||||
### Create API Route
|
### Create API Route
|
||||||
|
|
||||||
We need to mount the handler to an API route. Create a file inside `/server/api` called `[...auth].ts` and add the following code:
|
We need to mount the handler to an API route. Create a file inside `/server/api/auth` called `[...all].ts` and add the following code:
|
||||||
|
|
||||||
```ts title="server/api/[...auth].ts"
|
```ts title="server/api/auth/[...all].ts"
|
||||||
import { auth } from "~/lib/auth"; // import your auth config
|
import { auth } from "~/lib/auth"; // import your auth config
|
||||||
|
|
||||||
export default defineEventHandler((event) => {
|
export default defineEventHandler((event) => {
|
||||||
@@ -17,7 +17,7 @@ export default defineEventHandler((event) => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
<Callout type="info">
|
<Callout type="info">
|
||||||
You can change the path on your better-auth configuration but it's recommended to keep it as `/api/[...auth]`
|
You can change the path on your better-auth configuration but it's recommended to keep it as `/api/auth/[...all]`
|
||||||
</Callout>
|
</Callout>
|
||||||
|
|
||||||
### Migrate the database
|
### Migrate the database
|
||||||
|
|||||||
Reference in New Issue
Block a user