await request.json() destructuring body?
I'm getting 200, but all I'm getting on the logs is:
4 Replies
does it work if you do (without destructuring
{ body }
)Thanks @lee ! That works. Damn I feel stupid haha. I was following this part of the documentation though: https://docs.convex.dev/functions/http-actions#defining-http-actions
In which case does destructuring work?
HTTP Actions | Convex Developer Hub
HTTP actions allow you to build an HTTP API right in Convex!
it works in that example because the json being sent has the keys
body
and author
. the json your example sends has keys email
and username
, so you can destructure const { email, username } = await request.json()
we should change the example to avoid using body
(maybe call it messageText
) to avoid confusionGot it, thanks for this!