-
-
Save reborg/b04aab004737be36249074a819cbec2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; browser req | |
(defn fetch [template placeholders] | |
(let [snippet "<switching-to> closing script"] | |
(POST "/snippets" | |
{:params {:template "template" :placeholders "placeholders"} | |
:handler #(.log js/console (str "ok: " %)) | |
:error-handler #(.log js/console (str "error: " %))}) | |
(reduce-kv (fn [s k v] (s/replace s (re-pattern k) v)) snippet placeholders))) | |
;; server handler | |
(defroutes app-routes | |
; (POST "/snippets" request {:body (str "got request with " request)}) | |
; (POST "/snippets" {body :body} {:body (str "got body " (slurp body))}) | |
(POST "/snippets" {body-params :body-params} {:body (str "got params " body-params)}) | |
(resources "/")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment