diff options
-rw-r--r-- | ennu.el | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -7,6 +7,7 @@ (require 'cl) (require 'map) (require 'memoize) +(require 'simple-httpd) (defvar ennu-version "0.1.0" "Ennu version string") @@ -444,4 +445,18 @@ as keys. Keys are compared using `equal'." (delete-directory output t) (rename-file temporary-directory output t)))))) +;;; Server +;;; +;;; Test HTTP server to serve the blog locally + +(defun ennu-serve () + (interactive) + (setq httpd-root (expand-file-name (ennu-setting :output-directory) + (ennu-setting :working-directory))) + (defun httpd/ (proc uri-path query request) + (pcase (httpd-status (httpd-gen-path uri-path)) + (200 (httpd-serve-root proc httpd-root uri-path request)) + (_ (httpd-serve-root proc httpd-root (concat uri-path ".html") request)))) + (httpd-start)) + (provide 'ennu) |