From bc1ba43d2e23ff6674c92f4cd1ab5fb3b1a673ec Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 8 Sep 2023 12:28:25 -0500 Subject: first commit --- cock.mod.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 cock.mod.scm (limited to 'cock.mod.scm') diff --git a/cock.mod.scm b/cock.mod.scm new file mode 100644 index 0000000..5fc9c79 --- /dev/null +++ b/cock.mod.scm @@ -0,0 +1,24 @@ +(module cock (serve) + + (import (scheme) + (chicken base) + (chicken process signal) + (spiffy) + (utf8)) + + (define (eprint . xs) + (for-each (lambda (x) (display x (current-error-port))) + xs) + (newline (current-error-port))) + + (define (serve root port) + (set-signal-handler! signal/int + (lambda _ + (eprint "stopping server") + (exit))) + (eprint "Starting web server in " root "...") + (eprint "Served at http://localhost:" port) + (eprint "[Ctrl-c to stop]") + (parameterize ((server-port port) + (root-path root)) + (start-server)))) -- cgit 1.4.1-21-gabe81