import { NextRequest, NextResponse } from 'next/server'; import juice from 'juice'; export async function POST(req: NextRequest) { try { const { html } = await req.json(); if (!html) { return NextResponse.json({ error: 'HTML obsah je povinný.' }, { status: 400 }); } const inlined = juice(html, { preserveMediaQueries: true, removeStyleTags: false, applyWidthAttributes: true, applyHeightAttributes: true }); return NextResponse.json({ html: inlined }); } catch (err: any) { console.error('Inlining error:', err); return NextResponse.json({ error: err.message }, { status: 500 }); } }