Elnode access log buffer
Elnode’s performance is better than I expected, we can get about 5000 request per second out of it. The limiting factor is likely Emacs async IO which uses the select function. Replacing that with epoll or some other fast equivalent would likely give us node.js like performance.
Elnode comes with a webserver and a wiki server application.
Elnode has been optimized for rapid development. It’s designed to get you going quickly. Emacs is a great development environment for EmacsLisp and that’s why Elnode applications are rapid and easy to build.
Installing the latest versions of Elnode should automatically install working Wiki and Webserver apps listening on port 8000.
The webserver, by default, serves files (with an example included) from:
~/.emacs.d/elnode/public_html. Lots of stuff about the builtin webserver (including where it serves files from) can be configured with Elnode customizations:
M-x customize-group [RET] elnode [RET]
to see them all.
The Wiki server, by default, serves Wiki pages from
~/.emacs.d/elnode/wiki. That can be configured too.
Want to publish a directory of org-mode files? Here’s a full Elnode program that defines a handler to publish org files in a directory and also starts a server on port 8002.
;;; server.el --- -*- lexical-binding: t -*- (defvar my-org-dir "~/work/org") (defun my-elnode-org-handler (httpcon) (elnode-docroot-for my-org-dir with org-file on httpcon do (with-current-buffer (find-file-noselect org-file) (let ((org-html ;; This might throw errors so you could condition-case it (org-export-as-html 3 nil 'string))) (elnode-send-html httpcon org-html))))) (elnode-start 'my-elnode-org-handler :port 8002)
Now you can visit one of those files directly. A bit more work would be adding an index so you could pick which org-file you wanted to look at.
The latest version of Elnode is 0.9.8.
The latest development version of Elnode is 0.9.9 and includes:
The 1.0.0 version is planned and will include:
Because database access is such an important part of web applications, Elnode includes a simple database layer. The builtin implementation serializes Lisp objects to files.
We talk about Elnode on #emacs, I am often there so just shout me. Other people on #emacs know quite a lot about Elnode too.
We don’t have a mailing list yet. If you would like to provide one (ad free please) then please get in touch.
You need the latest version of Elnode to make the tutorial work.