Unlike more general of our libraries (like compojure-api and ring-swagger) this project is primarily intended for use in Metosin's projects. Feel free to use, but don't expect full support.
clojure.test
and Midje.(providing (mongo/create (:db env)) [:db])
will publish value of (:db mongo)
as (:db context)
(providing (mongo/create (:db env)) {:mongo :db})
will publish value of (:db mongo)
as (:mongo context)
(providing (mongo/create (:db env)) {:mongo (fn [component] (:db component))})
will publish value of (:db mongo)
as (:mongo context)
system
as argument. This makes it easy to create handler accessing system or context, directly or through middleware.
(http-kit/create (:http env) {:fn (fn [system] (let [ctx (palikka.core/create-context system)] (fn [req] {:body ctx})))})
(defn base-system [override]
(let [env (m/build-config
(m/resource "config-defaults.edn")
(m/file "./config-local.edn"))
create-handler (fn [system]
(-> (create-handler system)
(wrap-context system)))]
(component/system-map
:mongo (-> (mongo/create (:mongo env))
(providing {:db :db, :gfs :gfs}))
:http (-> (http-kit/create (:http env) {:fn create-handler})
; Though components are accessed through context,
; complete system map is needed for creating the context
(using [:mongo]))
:nrepl (nrepl/create (:nrepl env)))))
This library doesn't depend on libraries used by components, depend on these on your project.
[com.datomic/datomic-free "0.9.5327"]
or Datomic ProCopyright © 2015-2016 Metosin Oy
Distributed under the Eclipse Public License, the same as Clojure.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close