Next: , Previous: , Up: Hello World   [Contents]

5.4 More complex URL remapping

Try this code:

(use-modules (artanis artanis))
(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:

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.