A simple Emacs web server.
This used to be
httpd.el but there are already several of these out
there already of varying usefulness. Since the name change, it's been
stripped down to simply serve files and directory listings. Client
requests are sanitized so this should be safe, but I make no
This package is available on MELPA.
Once loaded, there are only two interactive functions to worry about:
httpd-stop. Files are served from
(can be changed at any time) on port
httpd-port. Directory listings
are enabled by default but can be disabled by setting
(require 'simple-httpd) (setq httpd-root "/var/www") (httpd-start)
Servlets can be defined with
defservlet. This one creates at servlet
/hello-world that says hello.
(defservlet hello-world text/plain (path) (insert "hello, " (file-name-nondirectory path)))
See the comment header in
simple-httpd.el for full details.
Packages built on simple-httpd:
The unit tests can (and should usually) be run like so,
emacs -batch -L . -l simple-httpd-test.el -f ert-run-tests-batch
It does some mocking to avoid using network code during testing.