import { NextResponse } from 'next/server';

const API_BASE =
  process.env.PHOENIX_API_INTERNAL_URL ||
  process.env.NEXT_PUBLIC_PHOENIX_API_URL ||
  'http://192.168.11.50:8080';

export async function GET(_request: Request, context: { params: { slug: string } }) {
  const slug = context.params.slug;
  const res = await fetch(`${API_BASE}/api/v1/marketplace/products/${slug}`, {
    cache: 'no-store',
  });
  const data = await res.json().catch(() => ({}));
  return NextResponse.json(data, { status: res.status });
}
