Permalink
Browse files

fix the webserver so it picks a docroot and make a copy of the exampl…

…e html file

--HG--
rename : test_docroot/example.html => example.html
  • Loading branch information...
1 parent a8de3ea commit 2c9dfe541ae2a03786a23b546b957f543aeb7c58 nferrier committed Oct 25, 2010
Showing with 15 additions and 4 deletions.
  1. +9 −3 elnode.el
  2. +1 −1 ertelnodetests.el
  3. +5 −0 example.html
View
@@ -720,9 +720,15 @@ This is a handler based on an asynchronous process."
Shows how to use elnode's built in webserver toolkit to make
something that will serve a docroot."
- (let ((webserver (elnode-webserver-handler-maker)))
- (funcall webserver httpcon))
- )
+ ;; Find the directory where this file is defined so we can serve
+ ;; files from there
+ (let ((docroot (file-name-directory
+ (buffer-file-name
+ (car
+ (save-excursion
+ (find-definition-noselect 'nicferrier-process-webserver nil)))))))
+ (let ((webserver (elnode-webserver-handler-maker docroot)))
+ (funcall webserver httpcon))))
(defun nicferrier-mapper-handler (httpcon)
"Demonstration function
View
@@ -16,7 +16,7 @@
(buffer-file-name
(car
(save-excursion
- (find-definition-noselect 'elnode--webserver-index-list nil))))))
+ (find-definition-noselect 'elnode--webserver-index-list-item nil))))))
(test-docroot (concat elnode-dir "test_docroot")))
(should (equal "<a href='/example.html'>example.html</a><br/>\r\n"
(elnode--webserver-index-list-item
View
@@ -0,0 +1,5 @@
+<html>
+ <body>
+ <h1>Hello!!!!</h1>
+ </body>
+</html>

0 comments on commit 2c9dfe5

Please sign in to comment.