Files
shadow-gunbuilder-ai-proto/lib/api/beta-signup/route.ts
T

38 lines
1.1 KiB
TypeScript

// app/api/beta-signup/route.ts
import { NextResponse } from "next/server";
export async function POST(request: Request) {
try {
const { email, useCase } = await request.json();
if (!email || typeof email !== "string") {
return NextResponse.json({ error: "Email is required" }, { status: 400 });
}
// TODO: Wire this to Brevo
// - Either call Brevo's API directly from here
// - Or POST to your Spring backend which then talks to Brevo
//
// Example (pseudo):
// await fetch("https://api.brevo.com/v3/contacts", {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// "api-key": process.env.BREVO_API_KEY!,
// },
// body: JSON.stringify({
// email,
// attributes: { USE_CASE: useCase },
// listIds: [123], // your Brevo list ID
// updateEnabled: true,
// }),
// });
console.log("New beta signup:", { email, useCase });
return NextResponse.json({ ok: true });
} catch (err) {
console.error(err);
return NextResponse.json({ error: "Server error" }, { status: 500 });
}
}