← back to Govarbitrage

src/app/api/listings/[id]/route.ts

12 lines

import { NextRequest, NextResponse } from "next/server";
import { getGatedListingDetail } from "@/lib/listing-detail";

export const dynamic = "force-dynamic";

export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
  const { id } = await params;
  const { listing, tier, gated } = await getGatedListingDetail(id);
  if (!listing) return NextResponse.json({ error: "Not found" }, { status: 404 });
  return NextResponse.json({ ...listing, tier, gated });
}