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:
Srikanth
2025-06-12 00:57:38 +05:30
committed by GitHub
parent 2a793139a5
commit c78574311b

View File

@@ -374,15 +374,15 @@ Better Auth supports any backend framework with standard Request and Response ob
<Tab value="tanstack-start">
```ts title="src/routes/api/auth/$.ts"
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/$')({
GET: ({ request }) => {
return auth.handler(request)
},
POST: ({ request }) => {
return auth.handler(request)
},
export const ServerRoute = createServerFileRoute('/api/auth/$').methods({
GET: ({ request }) => {
return auth.handler(request)
},
POST: ({ request }) => {
return auth.handler(request)
},
});
```
</Tab>