Newbie enjoying Clojure a lot here. So, I have an HTTP route:
(POST "/login" request (post-login request))
here, "request" is a map with a lot of http things inside. And the "post-login" function:
(defn post-login
;; Login into the app
[{{email "email" password "password"} :form-params session :session :as req}]
(let [user (modusers/get-user-by-email-and-password email password)]
;; If authenticated
(if-not (nil? (:user user))
(do
(assoc (response/found "/")
:session (assoc session :identity (:user user)) :flash "Bitte schön!"))
(assoc (response/found "/login") :flash "Etwas stimmt nicht mit deinem Zugriffsprozess"))))
but I don't understand how "request" is being destructuring. How "email" and "password" are now available inside the function?, and what ":as req" means? Is there a name to this "technique"?