Commits

Kresimir Sojat  committed 8de95ed

neman.web now uses neman.cells for automatic routes updates on path and/or rules changes.

  • Participants
  • Parent commits 4ae5616

Comments (0)

Files changed (1)

File src/net/ksojat/neman/web.clj

     (javax.servlet.http Cookie))
   (:refer-clojure :exclude [partial])
   (:require [net.ksojat.neman.jetty :as jetty])
-  (:use clojure.set net.ksojat.neman.core))
+  (:use
+    clojure.set
+    (net.ksojat.neman
+      core
+      [cells :only [cell]])))
 
 (declare
   *request* *response*)
           (update-response *response* res))))
     (when (seq rs) (recur url-path rs))))
 
-(defn update-routes [_ paths rules]
-  (create-routes paths rules))
-
 (defn mapper [paths rules]
-  (let [routes      (atom '())
-        swap-routes #(swap! routes update-routes @paths @rules)
-        update-on   #(add-watcher % :send (agent nil) (fn [& _] (swap-routes)))]
-    (swap-routes)
-    (update-on paths)
-    (update-on rules)
+  (let [routes (cell [paths rules] [p r] (create-routes p r))]
     (jetty/handler
       (fn [target request response dispatch]
         (binding [*request*  request