Last active
April 3, 2025 10:24
-
-
Save meta-forte/73bda3922525630714f38558b5f575c2 to your computer and use it in GitHub Desktop.
clojure local dev middleware
This file contains hidden or 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
| (ns (:require [ring.middleware.reload :as rl] | |
| [ring.middleware.refresh :as rf] | |
| [selmer.middleware :refer [wrap-error-page]] | |
| [prone.middleware :refer [wrap-exceptions]])) | |
| (defn wrap-nocache [handler] | |
| (fn [request] | |
| (let [response (handler request)] | |
| (assoc-in response [:headers "Cache-Control"] "no-cache")))) | |
| (defn wrap-dev [handler _opts] | |
| (print "wrapping ennv defaults middleware---------------------") | |
| (-> handler | |
| wrap-nocache | |
| (rl/wrap-reload {:dirs ["src/clj" "env/dev/clj" "env/dev/cljc" "resources/html" "resources/public/css" "resources/public/js"]}) | |
| (rf/wrap-refresh ["src/clj" "env/dev/clj" "env/dev/cljc" "resources/html" "resources/public" "resources/public/js"]) | |
| wrap-error-page | |
| (wrap-exceptions {:app-namespaces ['paramikaa]}) | |
| )) |
Author
meta-forte
commented
Apr 3, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment