Closed naveedhd closed 8 months ago
This is how you get the json body:
import std/json
proc endpoint*(ctx: Context) {.async.} =
let body = parseJson(ctx.request.body)
then let's say the body contains a key "email" with a value of type string, you can get it like this:
let email = body["email"].getStr()
I have in fact asked myself the same thing a couple years ago and wrote this self answered SO question to have sth to google in the future :smile:
ah right! I was looking at the request object and missed out on the body func
I am calling a POST request to a route with a request body (json) but the Context does not seem to have the request body or any helper associated to it.
Am I missing something or is it not implemented yet?