about summary refs log blame commit diff stats
path: root/scratch/htmx.scm
blob: 7ffb7e72b1093925fb0cb8f1e72c82dbf6911b05 (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                            






                         

                         

                   
               

                                      







                                 
#! /usr/bin/env chibi-scheme

; Simple HTTP server

(import 
  (chibi)
  (chibi net http-server)
  (chibi net servlet) 
  (chibi sxml))

(define config-port 8000)

(let ((count 0))
   (run-http-server
    config-port
    (lambda (cfg request next restart)
      (set! count (+ 1 count))
      (servlet-write request 
        (sxml->xml 
          `(html
            (head
              (title "counter")) 
            (body
              (h1 "Count: ")
              (p ,count))))))))