in tutorials-and-examples/vector-databases/NEXT-2024-Weaviate-Demo/demo-website/app/api/weaviate/route.ts [35:65]
export async function PATCH(request: NextRequest) {
const postData = await request.json(); // get request body
const title = postData.title;
const description = postData.description;
const link= postData.link;
const category = postData.category;
const productId = postData.productId;
let itemDetails = {
title: title,
category: category,
description: description,
link: link,
};
let result = await client.data
.merger()
.withClassName("Products")
.withId(productId)
.withProperties(itemDetails)
.do()
.then((res) => {
console.log(res);
})
.catch((err) => {
console.error(err);
});
return NextResponse.json({ status: "ok" });
}