3 ms·
>> I think it's simpler to pass state as an argument to your functions instead. That's less complex and easier to test. James, I was wondering what is the bes
by StreamBright 11y ago
>> I think it's simpler to pass state as an argument to your functions instead. That's less complex and easier to test.
James,
I was wondering what is the best course of action ini one particular situation. I am using your excellent libraries to create an HTTP API that needs to have state. I usually have an init function and using the ring init feature (see below). How would you not have an atom that hold lets say the DB connection info for a function that renders a html page displaying the version of the database, accessing the dbinfo with @dbinfo (that was updated at the init). Would it be possible to pass in to this function the state? Is it any different if I am calling @dbinfo in the actual function that renders the page or the calling function (router, or app definition)?
:ring {:init myproject.core/init
:destroy myproject.core/destroy
:handler myproject.core/handler}