I got the sense that that was the intention from the screencast you did, but I didn't appreaciate it till I tried it myself. Can you say more the purpose of start-biff? Maybe where is it used and why? https://github.com/jacobobryant/biff/blob/cd775ae4d31206f9aa9f2b8af5a30c6e3f7a0a4c/src/biff/system.clj#L203
Sure. The lifecycle of a typical biff process includes roughly the following:
1. setup (read config file, start nrepl server, ...)
2. start a crux node
3. start websockets
4. set up http routes
5. write static resources
6. start the web server
start-biff
handles steps 2-5. If you wanted to run multiple apps from the same process, you could call start-biff
again and have a separate crux node etc. for the other app. That's why start-biff
doesn't include 1 or 6: those two steps should only happen once per process, not once per app.
When the process starts, biff.core/-main
will handle 1 and 6 for you, and it'll search for namespaces with ^:biff
metadata. So you create a component/plugin in a namespace with ^:biff
, and that component should include a call to start-biff
. e.g. https://github.com/jacobobryant/biff/blob/master/example/src/example/core.clj#L30
I've since decided that was a mistake, by the way. at some point I'll change start-biff
so that it includes 1 and 6. instead of starting the process via biff.core/-main
, you'll use yourapp.core/-main
and have it do something like this:
(ns yourapp.core
...)
(def system (atom nil))
(defn -main []
(let [config ...]
(reset! system (start-biff config))))
(and for anyone who does want to run multiple apps in the same process, I'll have an example in the docs for how to do it)(just put up an issue to track that: https://github.com/jacobobryant/biff/issues/47)