about summary refs log tree commit diff stats
path: root/scratch
diff options
context:
space:
mode:
authorelioat <hi@eli.li>2023-12-07 19:41:31 -0500
committerelioat <hi@eli.li>2023-12-07 19:41:31 -0500
commitdc0cecaac05c77769efa7e74ba4ea8e808dbb6a1 (patch)
tree119f5db326f3fb0d5b17cf5675f76461a65d34ce /scratch
parent9af5c8368bd5f3d17b90eb0f4b2c37ab68692eaf (diff)
downloaddecember-2023-dc0cecaac05c77769efa7e74ba4ea8e808dbb6a1.tar.gz
*
Diffstat (limited to 'scratch')
-rw-r--r--scratch/htmx.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/scratch/htmx.scm b/scratch/htmx.scm
new file mode 100644
index 0000000..fd4696d
--- /dev/null
+++ b/scratch/htmx.scm
@@ -0,0 +1,20 @@
+#! /usr/bin/env chibi-scheme
+
+; Simple HTTP server
+; Returns a minimal HTML page with a single number incremented
+; every request. Binds to localhost port 8000.
+
+(import 
+  (chibi)
+  (chibi net http-server)
+  (chibi net servlet) 
+  (chibi sxml))
+
+(let ((count 0))
+   (run-http-server
+    8000
+    (lambda (cfg request next restart)
+      (set! count (+ 1 count))
+      (servlet-write request (sxml->xml `(html (body 
+        (p "Count: \n")
+        (p ,count))))))))
\ No newline at end of file