Trying to make a macro deconstruct parameters from a ring request map using a Macro. It works ok:
(defmacro defpage [fname args & body]
`(defn ~fname [{{:keys ~args} :params}]
~@body))
(defpage h-projects [name description]
; some code using name and description...
)
(defroutes app-routes
(ANY "/p/" [] h-projects)
But, I would like to be able to use the request map directly in the h-projects function:
(defpage h-projects [name description]
; some code using name and description, and also
; the request map.
)
How can the defpage macro be modified to make the request map available to the h-projects function?
I know I could change the parameters for the h-projects function, but I would like to keep the simple vector with parameters, not som deep nested deconstructing map.