route.ts

src/app/api/unsubscribe/route.ts
import { 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 | undefined
function unwrap(field: Field): string {
if (typeof field === 'string') return field
return field?.value ?? ''
}
export async function POST(req: Request) {
const body = await req.json().catch(() => ({}))

Showing the first 20 lines.

Get full code

Support

Talk to the developers of this project to learn more

We have been building professional websites for big clients for over 15 years. Gallop templates and blocks is our best foundation for SEO websites and web apps.

© 2026 Web Plant Media, LLC