mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 04:19:32 +00:00
docs(tanstack): migrate from createAPIFileRoute to createServerFileRoute (TanStack Start) (#2984)
The `createAPIFileRoute` method is no longer available in the latest version of TanStack Start. This commit updates the codebase to use the new `createServerFileRoute` method for handling API routes, ensuring compatibility with the latest library version.
This commit is contained in:
@@ -374,9 +374,9 @@ Better Auth supports any backend framework with standard Request and Response ob
|
|||||||
<Tab value="tanstack-start">
|
<Tab value="tanstack-start">
|
||||||
```ts title="src/routes/api/auth/$.ts"
|
```ts title="src/routes/api/auth/$.ts"
|
||||||
import { auth } from '~/lib/server/auth'
|
import { auth } from '~/lib/server/auth'
|
||||||
import { createAPIFileRoute } from '@tanstack/react-start/api'
|
import { createServerFileRoute } from '@tanstack/react-start/server'
|
||||||
|
|
||||||
export const APIRoute = createAPIFileRoute('/api/auth/$')({
|
export const ServerRoute = createServerFileRoute('/api/auth/$').methods({
|
||||||
GET: ({ request }) => {
|
GET: ({ request }) => {
|
||||||
return auth.handler(request)
|
return auth.handler(request)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user