melonpan
melonpan copied to clipboard
Parse body request
How can I parse the JSON from a POST request ? The code below isn't working
melonpan.post("/user" , (req, ctx) => {
let user_request = req.json().then((data) => {
console.log(data);
});
// console.log(user_request);
return ctx.json({status: "ok"});
});
i've used npm body-parser . but it is not working . is the solution for this ?
ReadableStream {
[Symbol(state)]: 4,
[Symbol(reader)]: undefined,
[Symbol(storedError)]: undefined,
[Symbol(disturbed)]: false,
[Symbol(readableStreamController)]: null,
[Symbol(bunNativeType)]: 4,
[Symbol(highWaterMark)]: undefined,
[Symbol(underlyingSource)]: undefined,
[Symbol(start)]: [Function],
cancel: [Function: cancel],
getReader: [Function: getReader],
pipeTo: [Function: pipeTo],
pipeThrough: [Function: pipeThrough],
tee: [Function: tee],
values: [Function: values],
[Symbol(Symbol.asyncIterator)]: [Function: lazyAsyncIterator]
}