Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse body request #20

Open
SimbaNinja917 opened this issue Jan 28, 2023 · 1 comment
Open

Parse body request #20

SimbaNinja917 opened this issue Jan 28, 2023 · 1 comment

Comments

@SimbaNinja917
Copy link

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"});
});
@bobwatcherx
Copy link

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]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants