instaservlet.ss
#lang scheme/base

(require
 (for-syntax scheme/base))

(require
 mzlib/runtime-path)

(require
 (planet "instaweb.ss" ("schematics" "instaweb.plt" 3))
 (planet "defaults.ss" ("schematics" "instaweb.plt" 3)))

(require
 (file "servlet-shim.ss"))

(define-runtime-path here ".")

(define servlet-shim (build-path here "servlet-shim.ss"))

;; : (request -> response) -> void
(define (go! servlet
             #:port              [port              8765]
             #:listen-ip         [listen-ip         "127.0.0.1"]
             #:htdocs-path       [htdocs-path       default-htdocs-path]
             #:mime-types-path   [mime-types-path   default-mime-types-path]
             #:servlet-namespace [servlet-namespace default-servlet-namespace])
  (with-servlet-function servlet
    (instaweb #:port port
              #:listen-ip listen-ip
              #:htdocs-path htdocs-path
              #:mime-types-path mime-types-path
              #:servlet-path servlet-shim
              #:servlet-namespace (cons `(file ,(path->string servlet-shim)) servlet-namespace))))

(provide go!)