Next Response
Answered
Kai posted this in #help-forum
KaiOP
am newbie in nextJs , I saw a video in which they are sending response through this Response Object I want to know about this response object . What are the props for this object ,if I have to send additional data like ok or something else how can I do it???
const newPrompt = new Prompt({
creator : userId,
prompt,
tag,
})
await newPrompt.save();
return new Response(JSON.stringify(newPrompt), { status: 201 })2 Replies
@Kai am newbie in nextJs , I saw a video in which they are sending response through this *Response* Object I want to know about this response object . What are the props for this object ,if I have to send additional data like **ok or something else** how can I do it???
const newPrompt = new Prompt({
creator : userId,
prompt,
tag,
})
await newPrompt.save();
return new Response(JSON.stringify(newPrompt), { status: 201 })
return new Response.json({ ok:true, newPrompt }, {status: 201})Answer
@Ray `return new Response.json({ ok:true, newPrompt }, {status: 201})`
KaiOP
ohh thnx a lot ,It really solved my query n sorry for such newbie question