import { NextRequest, NextResponse } from 'next/server' import { auth } from '@/auth' import { markdownToHtml } from '@/lib/markdown-to-html' export async function POST(request: NextRequest) { try { const session = await auth() if (!session?.user?.id) { return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }) } const { content } = await request.json() if (!content || typeof content !== 'string') { return NextResponse.json({ error: 'Content is required' }, { status: 400 }) } const html = markdownToHtml(content) return NextResponse.json({ html }) } catch (error: any) { return NextResponse.json({ error: error.message || 'Conversion failed' }, { status: 500 }) } }