Files
hoerdle/app/api/admin/login/route.ts
2025-11-21 12:25:19 +01:00

17 lines
585 B
TypeScript

import { NextResponse } from 'next/server';
export async function POST(request: Request) {
try {
const { password } = await request.json();
const adminPassword = process.env.ADMIN_PASSWORD || 'admin123'; // Default for dev if not set
if (password === adminPassword) {
return NextResponse.json({ success: true });
} else {
return NextResponse.json({ error: 'Invalid password' }, { status: 401 });
}
} catch (error) {
return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 });
}
}