Advertisement
Guest User

Untitled

a guest
Jan 27th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (ns live-update.handler
  2.   (:require [compojure.core :refer :all]
  3.             [compojure.route :as route]
  4.             [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
  5.             [clj-http.client :as client]))
  6.  
  7.  
  8. (comment
  9.  
  10.   (:body
  11.    (client/post "http://localhost:3000"
  12.                 {:form-params
  13.                  {:some-edn
  14.                   (pr-str
  15.                    '(defn hello
  16.                       []
  17.                       "hi there"))}}))
  18.  
  19.   (:body (client/get "http://localhost:3000")))
  20.  
  21.  
  22. (defn hello
  23.   []
  24.   "hey")
  25.  
  26. (defroutes app-routes
  27.   (GET "/" [] (#'hello))
  28.   (POST "/" [some-edn] (pr-str (eval (clojure.core/read-string some-edn))))
  29.   (route/not-found "Not Found"))
  30.  
  31. (def app
  32.   (wrap-defaults app-routes (assoc-in site-defaults [:security :anti-forgery] false)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement