import { toNextJsHandler } from 'better-auth/next-js'; import { ensureAuthSchema } from '@/lib/auth'; const authHandler = toNextJsHandler(async (request: Request) => { const auth = await ensureAuthSchema(); return auth.handler(request); }); export const { GET, POST, PATCH, PUT, DELETE } = authHandler;