git.s-ol.nu redirectly / eda6950
trailing-slash mmm URLs s-ol 3 years ago
1 changed file(s) with 3 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
00 (ns redirectly.core
11 (:require [carica.core :refer [config clear-config-cache!]]
2 [ring.util.response :as response]))
2 [ring.util.response :as response]
3 [clojure.string :refer [ends-with?]]))
34
45 (def routes (config :routes))
56
1920 :url)))
2021
2122 (defmethod url :url [{to :to}] to)
22 (defmethod url :mmm [{[_ path] :to}] (str "//mmm.s-ol.nu" path))
23 (defmethod url :mmm [{[_ path] :to}] (str "//mmm.s-ol.nu" path "/"))
2324
2425 (defn handler [req]
2526 (if-let [route (some #(matches? % (:uri req)) routes)]