Advertisement
dredder_gun

Untitled

May 17th, 2017
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (ns hello-ring.core2
  2.   (:require [compojure.core :refer :all]
  3.             [clojure.string :refer [starts-with?]]
  4.             [compojure.route :as route])
  5.   (:use ring.middleware.file
  6.         ring.middleware.resource
  7.         ring.middleware.content-type
  8.         ring.middleware.not-modified))
  9.  
  10. (def root "/home/aleksandr/projects/hello-ring/resources/public")
  11.  
  12. (defn handler
  13.   [request]
  14.   {:status 200
  15.     :headers {"Content-Type" "text/plain"}})
  16.  
  17. (defn debug [request]
  18.   (prn "request after all transforms" request)
  19.   request)
  20.  
  21. (defroutes my-routes
  22.   (GET "/" [] "Hello World")
  23.   (route/files "/" (do (println root) {:root root}))
  24.   (route/resources "/")
  25.   (route/not-found "Not Found"))
  26.  
  27. (def app
  28.   (-> my-routes
  29.       ; (wrap-resource root)
  30.       (wrap-content-type)
  31.       (wrap-not-modified)
  32.       debug))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement