Skip to content

Instantly share code, notes, and snippets.

@hendore
Created October 9, 2019 23:19
Embed
What would you like to do?
Clojure account registration
(declare insert-account! send-welcome-email!)
(defn register-account!
[account-info]
(when-let [account (insert-account! account-info)]
(send-welcome-email! account)))
(defn- insert-account!
[account-info]
(let [account (select-keys account-info [:name :email :phone :password])]
(jdbc/insert! pgsql-config :accounts account {:result-set-fn first})))
(defn- send-welcome-email!
[{:keys [email]}]
(str "Sending welcome email to " email))
(defn registration-req-handler
[request]
(register-account! (request :body)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment