src/app/api/unsubscribe/route.tsimport { prisma } from '@/utils/prisma'import { NextResponse } from 'next/server'export const runtime = 'nodejs'export const dynamic = 'force-dynamic'function isValidEmail(email: string): boolean {const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/return regex.test(email)}type Field = { value: string; label?: string | null } | string | undefinedfunction unwrap(field: Field): string {if (typeof field === 'string') return fieldreturn field?.value ?? ''}export async function POST(req: Request) {const body = await req.json().catch(() => ({}))
Showing the first 20 lines.
Get full code