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

did the code … and maybe I spoke too soon

genRaiy15:12:10

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

genRaiy15:12:45

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

genRaiy15:12:01

but then got a complaint about not finding mount

genRaiy15:12:26

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

genRaiy15:12:39

is this invocation wrong...

genRaiy15:12:59

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

genRaiy15:12:49

I have the connection like this...

genRaiy15:12:53

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

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

genRaiy15:12:23

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

genRaiy15:12:01

it is then required like this

genRaiy15: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)})

genRaiy15: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}

genRaiy23:12:56

Thanks I should have known to use mount.core!

genRaiy23:12:44

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