import { NextResponse } from 'next/server'; import { getAuthService } from '@/lib/auth'; export async function POST(request: Request) { try { const body = await request.json(); const { email, password } = body; if (!email || !password) { return NextResponse.json( { error: 'Email and password are required' }, { status: 400 } ); } const authService = getAuthService(); const session = await authService.loginWithEmail({ email, password }); return NextResponse.json({ success: true, session }); } catch (error) { return NextResponse.json( { error: error instanceof Error ? error.message : 'Login failed' }, { status: 401 } ); } }