Hoplon With Castra Error Loading The Backend

50 Views Asked by At

I have been having a similar problem for a while. When I use the following in my 'build.boot' it doesn't load the backend until I go in and edit a backend file and then save. I was wondering how I can get it to load the backend on 'boot dev'.

(deftask dev
 []
 (comp
  (serve
   :port    8000
   :handler 'myapp.handler/app
   :reload  true)
  (watch)
  (hoplon)
  (reload)
  (cljs)))

Cheers,

:::EDIT::: If I edit the 'index.cljs.hl' file and just remove the (rpc/init) function then save then re-insert the (rpc/init) function it seems to load the backend. I tried many things from using on page load to moving the position of the (rpc/init) in the index page. I don't quite understand why it requires editing and saving to make it work.

1

There are 1 best solutions below

1
On BEST ANSWER

There is most likely a better way, but the following should work:

(deftask dev
 []
 (comp
  (serve
   :port    8000
   :handler 'myapp.handler/app
   :reload  true)

  ;; duplicate these
  (hoplon)
  (reload)
  (cljs)

  (watch)
  (hoplon)
  (reload)
  (cljs)))

You can then refactor it like so:

(deftask do-stuff []
 (comp
  (hoplon)
  (reload)
  (cljs)))


(deftask dev
 []
 (comp
  (serve
   :port    8000
   :handler 'myapp.handler/app
   :reload  true)
   (do-stuff) ; init
   (watch)
   (do-stuff)))