Passing state as parameter to a ring handler?
问题 How does one inject state into ring handlers most conveniently (without using global vars)? Here is an example: (defroutes main-routes (GET "/api/fu" [] (rest-of-the-app the-state))) (def app (-> (handler/api main-routes))) I would like to get the-state into the compojure handler for main-routes . The state might be something like a map created with: (defn create-app-state [] {:db (connect-to-db) :log (create-log)}) In a non ring application I would create the state in a main function and