Skip to content

Commit

Permalink
Housekeeping: 694d6f9
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Aug 11, 2014
1 parent 9d4c1bb commit eb4ac6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
3 changes: 2 additions & 1 deletion example-project/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
;;
[compojure "1.1.8"] ; Or routing lib of your choice
[ring "1.3.0"]
[ring/ring-defaults "0.1.1"]
;; [ring-anti-forgery "1.0.0"]
[ring/ring-defaults "0.1.1"] ; Incl. `ring-anti-forgery`, etc.
[hiccup "1.0.5"] ; Optional, just for HTML
[org.clojure/core.match "0.2.1"] ; Optional but quite handly
]
Expand Down
15 changes: 6 additions & 9 deletions example-project/src/example/my_app.cljx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
[clojure.string :as str]
[compojure.core :as comp :refer (defroutes GET POST)]
[compojure.route :as route]
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]
[ring.middleware.defaults]
[hiccup.core :as hiccup]
[org.httpkit.server :as http-kit-server]
[clojure.core.match :as match :refer (match)]
Expand Down Expand Up @@ -105,17 +105,14 @@
(route/resources "/") ; Static files, notably public/main.js (our cljs target)
(route/not-found "<h1>Page not found</h1>"))

#+clj
(def my-middleware
(assoc-in site-defaults [:security :anti-forgery]
{:read-token (fn [req] (-> req :params :csrf-token))}))

#+clj
(def my-ring-handler
(wrap-defaults my-routes my-middleware))
(let [ring-defaults-config
(assoc-in ring.middleware.defaults/site-defaults [:security :anti-forgery]
{:read-token (fn [req] (-> req :params :csrf-token))})]
(ring.middleware.defaults/wrap-defaults my-routes ring-defaults-config)))

#+clj
(defonce http-server_ (atom nil))
#+clj (defonce http-server_ (atom nil))

#+clj
(defn stop-http-server! []
Expand Down

0 comments on commit eb4ac6e

Please sign in to comment.