Fork me on GitHub

It looks like web handlers don’t get access to the instantiated top level keys, such as a db connection. For example in:

(defmethod ig/init-key :foobar.handler/example [_ {:keys [db] :as options}]
  (context "/example" []
    (GET "/" []
      {:body {:example "data"}})))
db will be a function and not the instantiated object I’m looking for. I must be missing something, I’m not seeing how to provide the db connection to the web handler.


(and if I call that function, I get the instantiated object)


What is your config.edn?


oops, it looks like I must have been following some module code for inspiration when writing the db part - modules return functions that accept the conf, but regular components do not. sorry for the noise!

👍 4

Basically, what you get is what you returned from ig/init-key multimethod.