mirror of
https://github.com/vercel/commerce.git
synced 2025-06-28 01:11:24 +00:00
12 lines
432 B
TypeScript
12 lines
432 B
TypeScript
import { woocommerce } from "lib/woocomerce/woocommerce";
|
|
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
export async function POST(req: NextRequest) {
|
|
try {
|
|
const data = await req.json();
|
|
const cart = await woocommerce.post('customers', data);
|
|
return NextResponse.json(cart, { status: 200 });
|
|
} catch (error) {
|
|
return NextResponse.json({ error: 'Failed to add item to cart' }, { status: 500 });
|
|
}
|
|
} |