From 2ee5595de4dc3f8c753e36bc470b3cdb7b5c3d2c Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Fri, 23 Apr 2010 19:30:02 -0600 Subject: [PATCH] nicer html experience --- propagator.org | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/propagator.org b/propagator.org index 32acaed..dd9061e 100644 --- a/propagator.org +++ b/propagator.org @@ -152,15 +152,27 @@ which will render different views of the related data. (defn app [req] (binding [*out* out] (println (:uri req))) (or + ;; page to accept input + (when (= "/" (:uri req)) + {:status 200 + :headers {"Content-Type" "text/html"} + :body (apply str + "
" + "Word: " + "" + "
")}) ;; dump value into "input" cell - (when-let [matched (re-matches #"/add/(.+)" (:uri req))] - (set-cell input (second matched)) + (when (re-matches #"/add" (:uri req)) + (set-cell input (second (re-matches #".+=(.+)" (:query-string req)))) {:status 303 :headers {"Location" "../list"}}) ;; render the value of the "list" cell (when-let [matched (re-matches #"/list" (:uri req))] {:status 200 :headers {"Content-Type" "text/html"} - :body (apply str (flatten (list "")))})))) + :body (apply str (flatten (list "" + "

another word

")))})))) (run-jetty app {:port 3000}) #+end_src -- 2.11.4.GIT