Table of Contents
All of request params
, url params
, query params
is stored in params:Params
.
proc index*(request:Request, params:Params):Future[Response] {.async.} =
let id = params.getInt("id")
let email = params.getStr("email")
proc getStr*(params:Params, key:string, default=""):string
proc getInt*(params:Params, key:string, default=0):int
proc getFloat*(params:Params, key:string, default=0.0):float
proc getBool*(params:Params, key:string, default=false):bool
proc getJson*(params:Params, key:string, default=newJObject()):JsonNode
proc getAll*(params:Params):JsonNode
<input type="file" name="img">
proc store*(request:Request, params:Params):Future[Response] {.async.} =
if params.hasKey("img"):
# save as original file name in public/sample
params.save("img", "./public/sample")
# save and rename in public/sample/image.jpg
params.save("img", "./public/sample", "image")
proc save*(params:Params, key, dir:string) =
proc save*(params:Params, key, dir, newFileName:string) =