summaryrefslogtreecommitdiff
path: root/ennu.el
diff options
context:
space:
mode:
Diffstat (limited to 'ennu.el')
-rw-r--r--ennu.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/ennu.el b/ennu.el
index 01cabb7..c24739e 100644
--- a/ennu.el
+++ b/ennu.el
@@ -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)