mirror of
https://github.com/EdiFarcas/Car-Fuel-Tracking-App.git
synced 2026-06-22 05:00:53 +03:00
12 lines
432 B
TypeScript
12 lines
432 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { prisma } from '@/lib/prisma';
|
|
|
|
export async function POST(req: Request) {
|
|
const { name, email, message } = await req.json();
|
|
if (!message) return NextResponse.json({ error: 'Message required' }, { status: 400 });
|
|
const contact = await prisma.contactMessage.create({
|
|
data: { name, email, message },
|
|
});
|
|
return NextResponse.json({ success: true, id: contact.id });
|
|
}
|