second commit
This commit is contained in:
15
app/api/user/[id]/route.tsx
Normal file
15
app/api/user/[id]/route.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
// import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
|
||||
|
||||
// export async function PUT(req:NextRequest, {params} : { params: { id: number}}){
|
||||
// const body = await req.json()
|
||||
// if(!body.name)
|
||||
// return NextResponse.json({error:'Name is equied'}, { status: 400})
|
||||
|
||||
// if(params.id>10)
|
||||
// return NextResponse.json({error:'User noty found'}, { status: 404})
|
||||
|
||||
// return NextResponse.json({id:1, name: body.name})
|
||||
|
||||
// }
|
||||
26
app/api/user/route.tsx
Normal file
26
app/api/user/route.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
// import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
// export function GET(req:NextRequest){
|
||||
// return NextResponse.json([
|
||||
// {
|
||||
// id:1,
|
||||
// name: 'John'
|
||||
// },
|
||||
// {
|
||||
// id:1,
|
||||
// name:'Mosh'
|
||||
// }
|
||||
// ])
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// export async function POST(req:NextRequest){
|
||||
// const body = await req.json()
|
||||
|
||||
// if(!body?.name)
|
||||
// return NextResponse.json({error:'Name is Required'}, {status:400})
|
||||
// return NextResponse.json({id:1, name: body.name})
|
||||
// }
|
||||
Reference in New Issue
Block a user