I use noir.
Having :
(defpage "/welcome" [] "Welcome to Noir!")
I do I make both these URL works:
http://localhost:8080/welcome
http://localhost:8080/welcome/
Thanks!
EDIT: Here's the complete answer.
In server.clj
, add up (:use [ring.util.response :only [redirect]])
Then write :
(defn wrap-slash
""
[handler]
(fn [{:keys [uri] :as req}]
(if (and (.endsWith uri "/") (not= uri "/"))
(handler (assoc req :uri (.substring uri
0 (dec (count uri)))))
(handler req))))
(server/add-middleware wrap-slash)
Noir's routing is more strict than some others, so take a look at this question which, while having a different title, is asking the same thing.