Files
nextjs/app/api/products/route.tsx
2024-12-16 13:30:44 +05:30

34 lines
776 B
TypeScript

// import { NextRequest, NextResponse } from "next/server";
// import schema from "./schema";
// export function GET(req: NextRequest) {
// return NextResponse.json([
// {
// id: 1,
// naame: 'Milk',
// price: 2.5
// }, {
// id: 2,
// naame: 'Bread',
// price: 3.5
// },
// ])
// }
// export async function POST(req:NextRequest) {
// const body = await req.json()
// console.log(body);
// const validation = schema.safeParse(body)
// if (!validation.success)
// return NextResponse.json(validation.error.errors, {status:400})
// return NextResponse.json({id:10, name: body.name, price: body.price }, { status: 201})
// }