mob*_*ick 10 lisp webserver web-applications hunchentoot
Hunchentoot文档说明:
"ACCEPTOR的方法尝试提供相对于它的ACCEPTOR-DOCUMENT-ROOT的静态文件."
acceptor-document-root acceptor =>(或pathname null)
(setf(acceptor-document-root acceptor)new-value)
我在将这个文档翻译成实际的Lisp代码时遇到了麻烦.
有人可以给我一个例子,告诉我如何告诉Hunchentoot在哪里寻找静态网页服务?
Vse*_*kin 12
最简单的代码翻译将是这样的:
(hunchentoot:start (make-instance 'hunchentoot:acceptor :port 4242
:document-root #p"<path to static files dir>"))
Run Code Online (Sandbox Code Playgroud)
chr*_*hrm 10
这是一个服务于单个静态网页的代码段:
(push (create-static-file-dispatcher-and-handler
"/stylesheet.css" "~/projects/project-x/stylesheet.css")
*dispatch-table*)
Run Code Online (Sandbox Code Playgroud)
要使整个文件夹可用,请尝试create-folder-dispatcher-and-handler.