asynchttpserver: import json in the example code
The example code won't compile unless json is imported, because of the use of the %* operator. This can trip-up inexperienced Nim developers.
This commit is contained in:
parent
6ee487b0eb
commit
de7f42a741
1 changed files with 1 additions and 0 deletions
|
|
@ -85,6 +85,7 @@ proc respond*(req: Request, code: HttpCode, content: string,
|
||||||
## Examples
|
## Examples
|
||||||
## --------
|
## --------
|
||||||
## .. code-block::nim
|
## .. code-block::nim
|
||||||
|
## import json
|
||||||
## proc handler(req: Request) {.async.} =
|
## proc handler(req: Request) {.async.} =
|
||||||
## if req.url.path == "/hello-world":
|
## if req.url.path == "/hello-world":
|
||||||
## let msg = %* {"message": "Hello World"}
|
## let msg = %* {"message": "Hello World"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue