This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Ok I think I get it now, gets the value of a thing at time of execution, not definition
it's syntax that is the same as https://clojuredocs.org/clojure.core/var
Hi, I'm a newbie and am trying to use the stuartsierra.component framework. I'm confused as to how I use components that I've created. For example. Here we have the function upload-receipt. https://github.com/Moocar/clojure-west-2015/blob/master/src/system.clj#L49 Where would this be called from / who would be passing the uploader and receipt params here?
@timfield: It’s completely up to you. If you were to call upload-receipt from a repl, you’d first instantiate a system and then pull the component you want out of it. Then you can just call upload-receipt with that component and any other data it takes. If you have something like a server, it’s a little more involved. You need to figure out how to pass the system or some of its components into the context of each request
Using something like pedestal, you could simply create an interceptor that adds the system as a top level key to each request, or if you go further own the rabbit hole, you can even define each endpoint as a component that implements a protocol, and then in your routing table, wire up the url path to the appropriate component