diff options
author | Arun Isaac | 2019-08-27 12:19:37 +0530 |
---|---|---|
committer | Arun Isaac | 2019-08-27 12:19:37 +0530 |
commit | 7e92f58be075e11d6c88eb2fec19413b2247ac9d (patch) | |
tree | bb84e432cb13332efab21d8a1bd9f1badc4c8f8d | |
parent | 45683deb00d8e5417dc08cc32af439832f173968 (diff) | |
download | ennum-7e92f58be075e11d6c88eb2fec19413b2247ac9d.tar.gz ennum-7e92f58be075e11d6c88eb2fec19413b2247ac9d.tar.lz ennum-7e92f58be075e11d6c88eb2fec19413b2247ac9d.zip |
Implement test HTTP server.
* ennu.el (ennu-serve): New function.
-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) |