Hi,
Let say I have this code :
proc handler(req: Request) {.async.} =
  if req.url.path == "/hello-world":
    let msg = %* {"message": "Hello World"}
    let headers = newHttpHeaders([("Content-Type","application/json")])
    await req.respond(Http200, $msg, headers)
  else:
    await req.respond(Http404, "Not Found")
you should check the asyncdispatch docs
for async logic its recommended to use yield / asyncCheck instead of discard / try, except
per your specific question, asyncCheck should be preferred