kit-clj / kit

Lightweight, modular framework for scalable web development in Clojure
https://kit-clj.github.io/
MIT License
463 stars 43 forks source link

#119 issue query-fn middleware not injected in request #120

Closed muthuishere closed 7 months ago

muthuishere commented 7 months ago

based on https://github.com/kit-clj/kit/issues/119

muthuishere commented 7 months ago

(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!}]])

use the "" {:query-fn (:query-fn opts)}

it can inject query-fn in opts