Closed muthuishere closed 10 months ago
I think the motivation behind this change was that the api-routes
function already receives opts
as an argument so if you want to expose it you can do that by wrapping your routes like this
(defn api-routes [opts]
["" {:query-fn (:query-fn opts)} ; < this adds the :query-fn key to route-data
["/swagger.json"
{:get {:no-doc true
:swagger {:info {:title "<<ns-name>> API"}}
:handler (swagger/create-swagger-handler)}}]
["/health"
{:get health/healthcheck!}]])
I understand it now, But it could be helpful , if the documents and guestbook app has been updated accordingly. if there are shortage of devs , i can update and raise a PR against the guestbook app
@muthuishere that would be fantastic indeed! 🙌
If we are using SQL module , The recommended approach to get the query-fn instance is to get it from request (based on guestbook and other examples)
Its not working now , After this PR https://github.com/kit-clj/kit/pull/88/files#diff-3665446eb5dbdc0e0d4f09b49564dcd673de5d4c517acab045ea65c98fa232c2
Either we might need to revert back this code or change the api routes
Personally i feel this way is good , as all the query-fn instances is available , i can use it within. if not I would like to know how to get the :query-fn instance in some other service level