Try this code:
(use-modules (artanis artanis)) (init-server) (get "/hello/:who" (lambda (rc) (format #f "<p>hello ~a</p> " (params rc "who")))) (run #:port 8080)
Now you can try http://localhost:8080/hello/artanis in your browser.
There are two differences compared to the simpler example:
/hello/:who
", :who means you can use params to refer to the value of the par of the URL with the key "who". Like: (params rc "who")
.
And format is a Scheme lib function. It is similar to sprintf in the C language, which outputs text with a formatted pattern. The second argument #f (means FALSE) indicates that the formatted output should be returned in a string rather than printed out.