implement better-auth auth with postgres and route protection
This commit is contained in:
9
app/api/auth/[...all]/route.ts
Normal file
9
app/api/auth/[...all]/route.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user