import { ImageResponse } from 'next/og' import { NextRequest } from 'next/server' export const runtime = 'edge' export async function GET(request: NextRequest) { try { const { searchParams } = new URL(request.url) const tld = searchParams.get('tld') || 'com' const price = parseFloat(searchParams.get('price') || '0') const trend = parseFloat(searchParams.get('trend') || '0') const trendText = trend > 0 ? `+${trend.toFixed(1)}%` : `${trend.toFixed(1)}%` const trendColor = trend > 0 ? '#ef4444' : '#10b981' return new ImageResponse( (
{/* Logo/Brand */}
🐆
Pounce
{/* Main Content */}
{/* TLD */}
.{tld.toUpperCase()}
{/* Price */}
${price.toFixed(2)}
{/* Trend */}
1Y Trend: {trendText}
{/* Footer */}
Domain Intelligence • Real-time Market Data
), { width: 1200, height: 630, } ) } catch (e: any) { console.log(`Failed to generate image: ${e.message}`) return new Response(`Failed to generate image`, { status: 500, }) } }