diff options
Diffstat (limited to 'tissue/web/dev.scm')
-rw-r--r-- | tissue/web/dev.scm | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tissue/web/dev.scm b/tissue/web/dev.scm index ba43930..7f29be6 100644 --- a/tissue/web/dev.scm +++ b/tissue/web/dev.scm @@ -26,21 +26,22 @@ #:use-module (web server) #:use-module (web uri) #:use-module (xapian xapian) + #:use-module (tissue tissue) #:use-module (tissue utils) #:use-module (tissue web server) #:use-module (tissue web static) #:export (start-dev-web-server)) -(define (handler request body xapian-index css files) +(define (handler request body xapian-index project) "Handle web @var{request} with @var{body} and return two values---the response headers and body. See @code{start-dev-web-server} for -documentation of @var{xapian-index}, @var{css} and @var{files}." +documentation of @var{xapian-index} and @var{project}." (let ((path (uri-path (request-uri request)))) (log-request request) (cond ;; Search page ((member path (list "/" "/search")) - (search-handler request body xapian-index css)) + (search-handler request body xapian-index project)) ;; Files ((any (lambda (web-file) (cond @@ -50,7 +51,7 @@ documentation of @var{xapian-index}, @var{css} and @var{files}." (try-paths path)) => (cut file <> (file-writer web-file))) (else #f))) - files) + (tissue-configuration-web-files project)) => (lambda (file) (values `((content-type . ,(mime-type-for-extension (file-name-extension (file-name file))))) @@ -62,17 +63,17 @@ documentation of @var{xapian-index}, @var{css} and @var{files}." (else (404-response request))))) -(define (start-dev-web-server port xapian-index css files) +(define (start-dev-web-server port xapian-index project) "Start development web server listening on @var{port}. @var{xapian-index} is the path to the Xapian index to -search in. @var{css} is a URI to a stylesheet. @var{files} is a list -of @code{<file>} objects describing files to serve." +search in. @var{project} is a @code{<tissue-configuration>} object +describing the project." (format (current-error-port) "Tissue development web server listening at http://localhost:~a~%" port) ;; Explicitly dereference the module and handler variable each time ;; so as to support live hacking. (run-server (cut (module-ref (resolve-module '(tissue web dev)) 'handler) - <> <> xapian-index css files) + <> <> xapian-index project) 'http (list #:port port))) |