mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-27 01:16:55 -05:00
docs(tanstack): update code block for API route example and fix syntax spacing
This commit is contained in:
@@ -12,8 +12,8 @@ Before you start, make sure you have a Better Auth instance configured. If you h
|
||||
We need to mount the handler to a TanStack API endpoint.
|
||||
Create a new file: `/app/routes/api/auth/$.ts`
|
||||
|
||||
```ts
|
||||
import { auth } from '@/lib/auth'
|
||||
```ts title="routes/api/auth/$.ts"
|
||||
import { auth } from '@/lib/auth' // import your auth instance
|
||||
import { createAPIFileRoute } from '@tanstack/react-start/api'
|
||||
|
||||
export const APIRoute = createAPIFileRoute('/api/auth/$')({
|
||||
@@ -24,6 +24,4 @@ export const APIRoute = createAPIFileRoute('/api/auth/$')({
|
||||
return auth.handler(request)
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
This will allow you to access use the `getSession` method in all of your routes.
|
||||
```
|
||||
Reference in New Issue
Block a user