not-found-404.scm 502 B

12345678910111213141516171819
  1. (library (handlers not-found-404)
  2. (export not-found-404-handler)
  3. (import
  4. (except (rnrs base) let-values error)
  5. (only (guile)
  6. lambda* λ)
  7. ;; standard web library
  8. (web request)
  9. (web response)
  10. (web uri)))
  11. (define not-found-404-handler
  12. (λ (request body)
  13. "Answer with a 404 HTTP status code."
  14. (values (build-response #:code 404)
  15. (string-append "requested resource not found: "
  16. (uri->string (request-uri request))))))