;   This file launches a web-server serving a local
;   version og "List it!". Open this file in DrScheme
;   and hit "Run". Then open the printed link in a
;   web-browser near you.

; If for some reason there is a problem loading SQLite,
; then try closing all DrScheme windows including
; HelpDesks, and start DrScheme again.

; If the problem persists, send a mail to the PLT mailing list.

;   You can change the port number used, but
;   editing "servlets/config.scm".

(require (lib "" "web-server")
         (lib "" "web-server")
         (lib "" "planet")
         (lib "")


(define config-sexp
  `((port ,port)
    (max-waiting 40)
    (initial-connection-timeout 30)
       (default-indices "index.html" "index.htm")
       (log-format parenthesized-default)
        (servlet-message "servlet-error.html")
        (authentication-message "forbidden.html")
        (servlets-refreshed "servlet-refresh.html")
        (passwords-refreshed "passwords-refresh.html")
        (file-not-found-message "not-found.html")
        (protocol-message "protocol-error.html")
        (collect-garbage "collect-garbage.html"))
        (default-servlet-timeout 30)
        (password-connection-timeout 300)
        (servlet-connection-timeout 86400)
        (file-per-byte-connection-timeout 1/20)
        (file-base-connection-timeout 30))
        (configuration-root "conf")
        (host-root     ,(this-expression-source-directory))
        (file-root     "htdocs")
        (servlet-root  ".")
        (mime-types "mime.types")
        (password-authentication "passwords"))))

; start the web-server, and store a shutdown function
(define shutdown 
  (serve/web-config@ (configuration-table-sexpr->web-config@ config-sexp)))

(display (format "Start here: http://localhost:~a/servlets/control.scm\n\n" port))

(display "Press enter to shutdown.\n")