Fork me on GitHub
#mount
<
2015-12-27
>
raymcdermott15:12:33

did the code … and maybe I spoke too soon

raymcdermott15:12:10

i tried just requiring the namespace (in a hoplon app) and it didn’t seem to work

raymcdermott15:12:45

then I tried to hook ‘mount/start into the :init part of ring

raymcdermott15:12:01

but then got a complaint about not finding mount

raymcdermott15:12:26

but that’s odd because it definitely was downloaded and is there

raymcdermott15:12:39

is this invocation wrong...

raymcdermott15:12:59

(serve
      :init 'mount/start
      :handler 'app.handler/app
      :reload true
      :port 8000)

raymcdermott15:12:49

I have the connection like this...

raymcdermott15:12:53

(ns app.db
    (:require [mount.core :refer [defstate]]
      [app.datomic-seed :as ds]))

(defstate conn :start (ds/get-conn))

raymcdermott15:12:23

where get-conn is a function in the other namespace (and definitely works)

raymcdermott15:12:01

it is then required like this

raymcdermott15:12:06

(ns app.api
    (:require
      [app.db :refer [conn]]
      [app.datomic-query :as dq]
      [castra.core :refer [defrpc]]))

(defrpc get-state []
        {:random (dq/fetch-random-data conn)})

raymcdermott15:12:52

any tips on where I have veered off-piste?

tolitius21:12:09

@raymcdermott: start function lives in mount.core, not mount. I created a simple lein-ring example app in lein-ring mount branch:

:ring {:handler app.www/mount-example-routes
         :init mount.core/start
         :port 4242}

raymcdermott23:12:56

Thanks I should have known to use mount.core!

raymcdermott23:12:44

It's late here so I will try it out tomorrow and get back to you