example.scm 347 B

1234567891011121314
  1. (use-modules (web server))
  2. ;; 1. implement a web handler
  3. (define (hello-world-handler request request-body)
  4. (values
  5. ;; headers first
  6. '((content-type . (text/plain)))
  7. ;; then the response body
  8. "Hello World!"))
  9. ;; 2. Ready to go, let's start the web server
  10. ;; by default the server runs on port 8080
  11. (run-server hello-world-handler)