12345678910111213141516171819202122 |
- (library (handlers hello-world)
- (export hello-world-handler)
- (import
- (except (rnrs base) let-values error)
- (only (guile)
- lambda* λ)))
- (define hello-world-handler
- (lambda (request request-body)
- "A handler for a route."
- ;; A handler must return 2 values: The header and body
- ;; of the response.
- (values
- ;; Return the headers as first value (the bare
- ;; minimum).
- '((content-type . (text/plain)))
- ;; Then the response body. This is an example for
- ;; returning a string as second value, instead of a
- ;; procedure, which takes an output port.
- "Hello World!")))
|