Replace reverse-proxy/iframe approach with @ebook/@community/@navmini imports under /nav /book /community so localhost:3000 serves all three products directly. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
656 B
TypeScript
18 lines
656 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { createCreemCheckout, isCreemConfigured } from '@ebook/lib/creem';
|
|
|
|
export async function POST() {
|
|
if (!isCreemConfigured()) {
|
|
return NextResponse.json({ ok: false, error: 'creem not configured' }, { status: 503 });
|
|
}
|
|
|
|
try {
|
|
const checkout = await createCreemCheckout();
|
|
return NextResponse.json({ ok: true, checkoutUrl: checkout.checkoutUrl });
|
|
} catch (error) {
|
|
const message = error instanceof Error ? error.message : 'checkout failed';
|
|
console.error('Creem checkout', message);
|
|
return NextResponse.json({ ok: false, error: 'checkout failed' }, { status: 502 });
|
|
}
|
|
}
|