🎉 initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { createStartHandler, defaultStreamHandler } from '@tanstack/react-start/server'
|
||||
import type { Register } from '@tanstack/react-router'
|
||||
import type { RequestHandler } from '@tanstack/react-start/server'
|
||||
|
||||
import { getAuth } from '#/lib/auth-instance'
|
||||
|
||||
const startFetch = createStartHandler(defaultStreamHandler)
|
||||
|
||||
export type ServerEntry = { fetch: RequestHandler<Register> }
|
||||
|
||||
const fetch: RequestHandler<Register> = (request, opts) => {
|
||||
const url = new URL(request.url)
|
||||
|
||||
if (url.pathname.startsWith('/api/auth')) {
|
||||
return getAuth().handler(request)
|
||||
}
|
||||
|
||||
return startFetch(request, opts)
|
||||
}
|
||||
|
||||
export default { fetch } satisfies ServerEntry
|
||||
Reference in New Issue
Block a user