diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts index c95521a..cb15ae3 100644 --- a/src/app/api/auth/[...nextauth]/route.ts +++ b/src/app/api/auth/[...nextauth]/route.ts @@ -1,2 +1,10 @@ -import { handlers } from '@/auth'; // Referring to the auth.ts we just created +import { handlers } from '@/auth'; +import { NextRequest, NextResponse } from 'next/server'; + export const { GET, POST } = handlers; + +export async function middleware(request: NextRequest) { + if (request.nextUrl.pathname === '/') { + return NextResponse.redirect(new URL('/login', request.url)); + } +}