[racket] usage of plt-web-server command

From: J G Cho (gcho at fundingmatters.com)
Date: Fri Aug 31 13:49:22 EDT 2012

Near the end of 3.9 Soft State section found on
http://docs.racket-lang.org/web-server/stateless.html?q=%23%3Aquit&q=rackunit&q=commandline&q=substring&q=dispatch-rules&q=response/full#(part._stateless-example)

#lang web-server

(provide interface-version start)
(define interface-version 'stateless)

(define softie
  (soft-state
   (printf "Doing a long computation...\n")
   (sleep 1)))

(define (start req)
  (soft-state-ref softie)
  (printf "Done\n")
  (start
   (send/suspend
    (lambda (k-url)
      (response/xexpr
       `(html (body (a ([href ,k-url]) "Done"))))))))


$ plt-web-server -p 8080
Doing a long computation...
Done
Done
Done
Done

How does the above command know that it's supposed to execute the code
above it? Is there some convention for this magic to happen?

jGc

Posted on the users mailing list.