// app/api/contact/route.ts
import { validateHoneypot } from 'react-honeypot-field/validate';
export async function POST(req: Request) {
const body = await req.json();
const hp = validateHoneypot({
fieldValue: body.website,
mountedAt: body._mountedAt,
submittedAt: Date.now(),
});
if (!hp.ok) {
// Silently return 200 — don't reveal to the bot that it failed
return Response.json({ ok: true });
}
// ... process the real form
}
Server-side honeypot validation.
Use this in your API route / server action after the client passes
fieldValueand optionallymountedAtin the request body.