(defn start
([opts]
(-> handler
(wrap-resource "dynadoc-public")
(wrap-resource "dynadoc-extend")
(start opts)))
([app opts]
(when-not @*web-server
; start watcher if parsing cljs statically
(when-not (:*cljs-env opts)
(add-watch watch/*cljs-info :cljs-info
(fn [_ _ _ cljs-info]
(doseq [[channel uri] @watch/*channel->uri]
(let [[type ns-sym var-sym] (u/parse-uri uri)]
(->> {:static? false :cljs-nses-and-vars (u/flatten-vals cljs-info)
:type type :ns-sym ns-sym :var-sym var-sym}
(page-state uri)
pr-str
(send! channel))))))
(watch/init-watcher!))
; start server
(->> (merge {:port 0} opts)
(reset! *options)
(run-server (-> app wrap-content-type wrap-params wrap-keyword-params))
(reset! *web-server)
print-server))))